Topological linelike bound states in the continuum