From 7988da5c6889e94329095c30d9445ed9f05ee40e Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 3 Oct 2006 00:15:28 +0000 Subject: [PATCH] remove DateTime binding; at least for now, keep XNode binding to basic types --- stepmania/src/HighScore.cpp | 10 ++++++---- stepmania/src/Profile.cpp | 4 ++-- stepmania/src/XmlFile.cpp | 2 -- stepmania/src/XmlFile.h | 2 -- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/stepmania/src/HighScore.cpp b/stepmania/src/HighScore.cpp index 447bad8682..cb73cf411f 100644 --- a/stepmania/src/HighScore.cpp +++ b/stepmania/src/HighScore.cpp @@ -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; iGetName() == "LastPlayed" ) { - p->GetValue( dtLastPlayed ); + RString s; + p->GetValue( s ); + dtLastPlayed.FromString( s ); } else if( p->GetName() == "HighScore" ) { diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index 3723acfd00..ac8bb9e714 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -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 ); diff --git a/stepmania/src/XmlFile.cpp b/stepmania/src/XmlFile.cpp index d6123acac9..db914ebbe3 100644 --- a/stepmania/src/XmlFile.cpp +++ b/stepmania/src/XmlFile.cpp @@ -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 { diff --git a/stepmania/src/XmlFile.h b/stepmania/src/XmlFile.h index 5e08a98fa9..ecfcfd4540 100644 --- a/stepmania/src/XmlFile.h +++ b/stepmania/src/XmlFile.h @@ -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 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 XAttrs;