Cleande up the deserialization code

This commit is contained in:
Xawotihs
2011-10-02 14:11:30 +00:00
parent 7e1566fe77
commit 86131f7ea0
7 changed files with 22 additions and 220 deletions
+2 -4
View File
@@ -41,6 +41,8 @@ public:
virtual JQuadPtr getIcon(){return JQuadPtr();}
bool parseLine(const string& s);
friend ostream& operator<<(ostream& out, const Damageable& p);
};
class Damage: public Interruptible
@@ -71,8 +73,4 @@ class DamageStack : public GuiLayer, public Interruptible
DamageStack(GameObserver *observer);
};
ostream& operator<<(ostream& out, const Damageable& p);
istream& operator>>(istream& in, Damageable& p);
#endif
+1 -2
View File
@@ -202,8 +202,7 @@ public:
};
ostream& operator<<(ostream&, const MTGGameZone&);
istream& operator>>(istream&, MTGGameZone&);
ostream& operator<<(ostream&, const MTGPlayerCards&);
istream& operator>>(istream&, MTGPlayerCards&);
#endif
-2
View File
@@ -95,8 +95,6 @@ public:
** Returns the path to the stats file of currently selected deck.
*/
std::string GetCurrentDeckStatsFile();
friend istream& operator>>(istream& in, Player& p);
bool parseLine(const string& s);
};
+15
View File
@@ -100,4 +100,19 @@ bool FileExists(const string & filename);
std::string buildFilePath(const vector<string> & folders, const string & filename);
std::string ensureFolder(const string & folderName);
template <class T> istream& operator>>(istream& in, T& p)
{
string s;
while(std::getline(in, s))
{
if(!p.parseLine(s))
{
break;
}
}
return in;
}
#endif