wxPropertyValue::wxPropertyValue(const wxPropertyValue& copyFrom)
{
+ m_value.string = (wxChar*) NULL;
m_modifiedFlag = FALSE;
Copy((wxPropertyValue& )copyFrom);
}
wxNode *node = the_list->First();
while (node)
{
- char *s = (char *)node->Data();
+ wxChar *s = (wxChar *)node->Data();
Append(new wxPropertyValue(s));
node = node->Next();
}
return new wxPropertyValue(m_value.stringPtr);
case wxPropertyValueNull:
- wxFAIL_MSG( T("Should never get here!\n" ) );
+ wxFAIL_MSG( wxT("Should never get here!\n" ) );
break;
}
return NULL;
void wxPropertyValue::Copy(wxPropertyValue& copyFrom)
{
+ if (m_type == wxPropertyValueString)
+ {
+ delete[] m_value.string ;
+ m_value.string = NULL;
+ }
m_type = copyFrom.Type();
switch (m_type)
return;
}
case wxPropertyValueNull:
- wxFAIL_MSG( T("Should never get here!\n" ) );
+ wxFAIL_MSG( wxT("Should never get here!\n" ) );
break;
}
}
if (node)
{
node->WritePropertyType(stream);
- stream.Append( T("(") );
+ stream.Append( wxT("(") );
node = node->m_next;
bool first = TRUE;
while (node)
{
if (!first)
- stream.Append( T(" ") );
+ stream.Append( wxT(" ") );
node->WritePropertyType(stream);
node = node->m_next;
if (node)
- stream.Append( T(",\n" ) );
+ stream.Append( wxT(",\n" ) );
first = FALSE;
}
- stream.Append( T(").\n\n") );
+ stream.Append( wxT(").\n\n") );
}
}
{
case wxPropertyValueInteger:
{
- tmp.Printf( T("%ld"), m_value.integer );
+ tmp.Printf( wxT("%ld"), m_value.integer );
stream.Append( tmp );
break;
}
case wxPropertyValueIntegerPtr:
{
- tmp.Printf( T("%ld"), *m_value.integerPtr );
+ tmp.Printf( wxT("%ld"), *m_value.integerPtr );
stream.Append( tmp );
break;
}
case wxPropertyValuebool:
{
if (m_value.integer)
- stream.Append( T("True") );
+ stream.Append( wxT("True") );
else
- stream.Append( T("False") );
+ stream.Append( wxT("False") );
break;
}
case wxPropertyValueboolPtr:
{
if (*m_value.integerPtr)
- stream.Append( T("True") );
+ stream.Append( wxT("True") );
else
- stream.Append( T("False") );
+ stream.Append( wxT("False") );
break;
}
case wxPropertyValueReal:
{
double d = m_value.real;
- tmp.Printf( T("%.6g"), d );
+ tmp.Printf( wxT("%.6g"), d );
stream.Append( tmp );
break;
}
case wxPropertyValueRealPtr:
{
double d = *m_value.realPtr;
- tmp.Printf( T("%.6g"), d );
+ tmp.Printf( wxT("%.6g"), d );
stream.Append( tmp );
break;
}
}
case wxPropertyValueStringPtr:
{
- wxFAIL_MSG( T("wxPropertyValue::WritePropertyType( wxPropertyValueStringPtr ) not implemented") );
+ wxFAIL_MSG( wxT("wxPropertyValue::WritePropertyType( wxPropertyValueStringPtr ) not implemented") );
/*
int i;
int len = strlen(*(m_value.stringPtr));
case wxPropertyValueList:
{
if (!m_value.first)
- stream.Append( T("[]") );
+ stream.Append( wxT("[]") );
else
{
wxPropertyValue *expr = m_value.first;
- stream.Append( T("[") );
+ stream.Append( wxT("[") );
while (expr)
{
expr->WritePropertyType(stream);
expr = expr->m_next;
if (expr)
- stream.Append( T(", ") );
+ stream.Append( wxT(", ") );
}
- stream.Append( T("]") );
+ stream.Append( wxT("]") );
}
break;
}
const wxChar *val = (const wxChar *)val1;
m_modifiedFlag = TRUE;
+
+ wxPropertyValueType oldType = m_type;
+ if (oldType == wxPropertyValueString)
+ {
+ delete[] m_value.string ;
+ m_value.string = NULL;
+ }
+
if (m_type == wxPropertyValueNull)
m_type = wxPropertyValueString;
}
else if (m_type == wxPropertyValueStringPtr)
{
- if (*m_value.stringPtr)
- delete[] *m_value.stringPtr;
+ wxFAIL_MSG( wxT("Shouldn't try to assign a wxString reference to a char* pointer.") );
if (val)
*m_value.stringPtr = copystring(val);
else
void wxPropertyValue::operator=(const long val)
{
+ wxPropertyValueType oldType = m_type;
+ if (oldType == wxPropertyValueString)
+ {
+ delete[] m_value.string ;
+ m_value.string = NULL;
+ }
+
m_modifiedFlag = TRUE;
if (m_type == wxPropertyValueNull)
m_type = wxPropertyValueInteger;
void wxPropertyValue::operator=(const bool val)
{
+ wxPropertyValueType oldType = m_type;
+ if (oldType == wxPropertyValueString)
+ {
+ delete[] m_value.string ;
+ m_value.string = NULL;
+ }
+
m_modifiedFlag = TRUE;
if (m_type == wxPropertyValueNull)
m_type = wxPropertyValuebool;
void wxPropertyValue::operator=(const float val)
{
+ wxPropertyValueType oldType = m_type;
+ if (oldType == wxPropertyValueString)
+ {
+ delete[] m_value.string ;
+ m_value.string = NULL;
+ }
+
m_modifiedFlag = TRUE;
if (m_type == wxPropertyValueNull)
m_type = wxPropertyValueReal;
void wxPropertyValue::operator=(const wxChar **val)
{
+ wxPropertyValueType oldType = m_type;
+ if (oldType == wxPropertyValueString)
+ {
+ delete[] m_value.string ;
+ m_value.string = NULL;
+ }
+
m_modifiedFlag = TRUE;
m_type = wxPropertyValueStringPtr;
wxChar *wxPropertyValidator::FloatToString (float number) {
static wxChar buf[20];
- wxSprintf (buf, T("%.6g"), number);
+ wxSprintf (buf, wxT("%.6g"), number);
return buf;
}
wxChar *wxPropertyValidator::DoubleToString (double number) {
static wxChar buf[20];
- wxSprintf (buf, T("%.6g"), number);
+ wxSprintf (buf, wxT("%.6g"), number);
return buf;
}