Remplissage d'une classe à partir d'un fichier texte
Bonjour,
J'aimerai pouvoir à partir d'un fichier texte, créer un objet, ranger chaque élément du fichier texte dans les attributs de l'objet.
Exemple de fichier texte :
Code:
1 2 3 4 5 6
| id=piece width=400 hauteur=300 couleur=azure border=blanc
refpos=tl basepos=tl
[
id=piece width=120% hauteur=10% couleur=rouge
refpos=bc basepos=tc
] |
Classe :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| class Bloc
{
protected :
std::string m_id;
std::string m_color;
std::string m_tl,m_tc,m_tr;
std::string m_bl, m_bc, m_br;
std::string m_ml, m_mc, m_mr;
public :
Bloc(std::string id, std::string color);
void CoordsBloc(int x, int y);
void lecture ();
}; |
Je ne vois vraiment pas comment faire