mercredi 4 novembre 2015

C++ - A library that allows easy importing of text files into classes?

Say I want to have 100 classes, and I want their data to be stored in a file. This might be what the class looks like:

class MyClass
    std::string name;
    std::vector<std::string> friends;

Is there a library that can be used to easily create and read these files without creating your own format/syntax? What I'm really looking for is a library that will, for example, automatically parse the first line as the 'name', then everything between the next two braces as 'friends', and repeat that.

I know it's quite trivial to program, but if I had 10 different types of class I would like an easier way than to manually create and parse 10 different formats.


Aucun commentaire:

Enregistrer un commentaire