remove DateTime binding; at least for now, keep XNode binding to basic types

This commit is contained in:
Glenn Maynard
2006-10-03 00:15:28 +00:00
parent 1a89ddfccd
commit 7988da5c68
4 changed files with 8 additions and 10 deletions
+6 -4
View File
@@ -88,7 +88,7 @@ XNode *HighScoreImpl::CreateNode() const
pNode->AppendChild( "PercentDP", fPercentDP );
pNode->AppendChild( "SurviveSeconds", fSurviveSeconds );
pNode->AppendChild( "Modifiers", sModifiers );
pNode->AppendChild( "DateTime", dateTime );
pNode->AppendChild( "DateTime", dateTime.GetString() );
pNode->AppendChild( "PlayerGuid", sPlayerGuid );
pNode->AppendChild( "MachineGuid", sMachineGuid );
pNode->AppendChild( "ProductID", iProductID );
@@ -119,7 +119,7 @@ void HighScoreImpl::LoadFromNode( const XNode *pNode )
pNode->GetChildValue( "PercentDP", fPercentDP );
pNode->GetChildValue( "SurviveSeconds", fSurviveSeconds );
pNode->GetChildValue( "Modifiers", sModifiers );
pNode->GetChildValue( "DateTime", dateTime );
pNode->GetChildValue( "DateTime", s ); dateTime.FromString( s );
pNode->GetChildValue( "PlayerGuid", sPlayerGuid );
pNode->GetChildValue( "MachineGuid", sMachineGuid );
pNode->GetChildValue( "ProductID", iProductID );
@@ -286,7 +286,7 @@ XNode* HighScoreList::CreateNode() const
XNode* pNode = new XNode( "HighScoreList" );
pNode->AppendChild( "NumTimesPlayed", iNumTimesPlayed );
pNode->AppendChild( "LastPlayed", dtLastPlayed );
pNode->AppendChild( "LastPlayed", dtLastPlayed.GetString() );
for( unsigned i=0; i<vHighScores.size(); i++ )
{
@@ -310,7 +310,9 @@ void HighScoreList::LoadFromNode( const XNode* pHighScoreList )
}
else if( p->GetName() == "LastPlayed" )
{
p->GetValue( dtLastPlayed );
RString s;
p->GetValue( s );
dtLastPlayed.FromString( s );
}
else if( p->GetName() == "HighScore" )
{
+2 -2
View File
@@ -1003,7 +1003,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const
pGeneralDataNode->AppendChild( "GoalCalories", m_iGoalCalories );
pGeneralDataNode->AppendChild( "GoalSeconds", m_iGoalSeconds );
pGeneralDataNode->AppendChild( "LastPlayedMachineGuid", m_sLastPlayedMachineGuid );
pGeneralDataNode->AppendChild( "LastPlayedDate", m_LastPlayedDate );
pGeneralDataNode->AppendChild( "LastPlayedDate", m_LastPlayedDate.GetString() );
pGeneralDataNode->AppendChild( "TotalDancePoints", m_iTotalDancePoints );
pGeneralDataNode->AppendChild( "NumExtraStagesPassed", m_iNumExtraStagesPassed );
pGeneralDataNode->AppendChild( "NumExtraStagesFailed", m_iNumExtraStagesFailed );
@@ -1165,7 +1165,7 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
pNode->GetChildValue( "GoalCalories", m_iGoalCalories );
pNode->GetChildValue( "GoalSeconds", m_iGoalSeconds );
pNode->GetChildValue( "LastPlayedMachineGuid", m_sLastPlayedMachineGuid );
pNode->GetChildValue( "LastPlayedDate", m_LastPlayedDate );
pNode->GetChildValue( "LastPlayedDate", s ); m_LastPlayedDate.FromString( s );
pNode->GetChildValue( "TotalDancePoints", m_iTotalDancePoints );
pNode->GetChildValue( "NumExtraStagesPassed", m_iNumExtraStagesPassed );
pNode->GetChildValue( "NumExtraStagesFailed", m_iNumExtraStagesFailed );
-2
View File
@@ -41,13 +41,11 @@ void XNodeValue::GetValue( int &out ) const { out = atoi(m_sValue); }
void XNodeValue::GetValue( float &out ) const { out = StringToFloat(m_sValue); }
void XNodeValue::GetValue( bool &out ) const { out = atoi(m_sValue) != 0; }
void XNodeValue::GetValue( unsigned &out ) const { out = strtoul(m_sValue,NULL,0); }
void XNodeValue::GetValue( DateTime &out ) const { out.FromString( m_sValue ); }
void XNodeValue::SetValue( const RString &v ) { m_sValue = v; }
void XNodeValue::SetValue( int v ) { m_sValue = ssprintf("%d",v); }
void XNodeValue::SetValue( float v ) { m_sValue = ssprintf("%f",v); }
void XNodeValue::SetValue( unsigned v ) { m_sValue = ssprintf("%u",v); }
void XNodeValue::SetValue( const DateTime &v ) { m_sValue = v.GetString(); }
const XNodeValue *XNode::GetAttr( const RString &attrname ) const
{
-2
View File
@@ -17,7 +17,6 @@ public:
void GetValue( float &out ) const;
void GetValue( bool &out ) const;
void GetValue( unsigned &out ) const;
void GetValue( DateTime &out ) const;
template<typename T>
T GetValue() const { T val; GetValue(val); return val; }
@@ -26,7 +25,6 @@ public:
void SetValue( int v );
void SetValue( float v );
void SetValue( unsigned v );
void SetValue( const DateTime &v );
};
typedef map<RString,XNodeValue*> XAttrs;