c++ abstraction of text interface