projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed typo : _ instead of wxT
[wxWidgets.git]
/
src
/
generic
/
prop.cpp
diff --git
a/src/generic/prop.cpp
b/src/generic/prop.cpp
index 537588ba1879a5f5964152d3e5818b6672391d89..ad6d3b521e20622e4add9c9b2efe9668ec6eb6f7 100644
(file)
--- a/
src/generic/prop.cpp
+++ b/
src/generic/prop.cpp
@@
-47,6
+47,7
@@
wxPropertyValue::wxPropertyValue(void)
wxPropertyValue::wxPropertyValue(const wxPropertyValue& copyFrom)
{
wxPropertyValue::wxPropertyValue(const wxPropertyValue& copyFrom)
{
+ m_value.string = (wxChar*) NULL;
m_modifiedFlag = FALSE;
Copy((wxPropertyValue& )copyFrom);
}
m_modifiedFlag = FALSE;
Copy((wxPropertyValue& )copyFrom);
}
@@
-328,7
+329,7
@@
wxPropertyValue *wxPropertyValue::NewCopy(void) const
return new wxPropertyValue(m_value.stringPtr);
case wxPropertyValueNull:
return new wxPropertyValue(m_value.stringPtr);
case wxPropertyValueNull:
- wxFAIL_MSG(
_
T("Should never get here!\n" ) );
+ wxFAIL_MSG(
wx
T("Should never get here!\n" ) );
break;
}
return NULL;
break;
}
return NULL;
@@
-336,6
+337,11
@@
wxPropertyValue *wxPropertyValue::NewCopy(void) const
void wxPropertyValue::Copy(wxPropertyValue& copyFrom)
{
void wxPropertyValue::Copy(wxPropertyValue& copyFrom)
{
+ if (m_type == wxPropertyValueString)
+ {
+ delete[] m_value.string ;
+ m_value.string = NULL;
+ }
m_type = copyFrom.Type();
switch (m_type)
m_type = copyFrom.Type();
switch (m_type)
@@
-369,12
+375,18
@@
void wxPropertyValue::Copy(wxPropertyValue& copyFrom)
case wxPropertyValueStringPtr:
{
wxChar** s = copyFrom.StringValuePtr();
case wxPropertyValueStringPtr:
{
wxChar** s = copyFrom.StringValuePtr();
+
+#if 0
// what is this? are you trying to assign a bool or a string? VA can't figure it out..
#if defined(__VISAGECPP__) || defined( __VISUALC__ )
(*this) = s;
#else
(*this) = s != 0;
#endif
// what is this? are you trying to assign a bool or a string? VA can't figure it out..
#if defined(__VISAGECPP__) || defined( __VISUALC__ )
(*this) = s;
#else
(*this) = s != 0;
#endif
+#endif // if 0
+
+ (*this) = (bool)(s != 0);
+
return ;
}
return ;
}
@@
-393,7
+405,7
@@
void wxPropertyValue::Copy(wxPropertyValue& copyFrom)
return;
}
case wxPropertyValueNull:
return;
}
case wxPropertyValueNull:
- wxFAIL_MSG(
_
T("Should never get here!\n" ) );
+ wxFAIL_MSG(
wx
T("Should never get here!\n" ) );
break;
}
}
break;
}
}
@@
-455,20
+467,20
@@
void wxPropertyValue::WritePropertyClause(wxString& stream) // Write this expre
if (node)
{
node->WritePropertyType(stream);
if (node)
{
node->WritePropertyType(stream);
- stream.Append(
_
T("(") );
+ stream.Append(
wx
T("(") );
node = node->m_next;
bool first = TRUE;
while (node)
{
if (!first)
node = node->m_next;
bool first = TRUE;
while (node)
{
if (!first)
- stream.Append(
_
T(" ") );
+ stream.Append(
wx
T(" ") );
node->WritePropertyType(stream);
node = node->m_next;
if (node)
node->WritePropertyType(stream);
node = node->m_next;
if (node)
- stream.Append(
_
T(",\n" ) );
+ stream.Append(
wx
T(",\n" ) );
first = FALSE;
}
first = FALSE;
}
- stream.Append(
_
T(").\n\n") );
+ stream.Append(
wx
T(").\n\n") );
}
}
}
}
@@
-479,43
+491,43
@@
void wxPropertyValue::WritePropertyType(wxString& stream) // Write as any oth
{
case wxPropertyValueInteger:
{
{
case wxPropertyValueInteger:
{
- tmp.Printf(
_
T("%ld"), m_value.integer );
+ tmp.Printf(
wx
T("%ld"), m_value.integer );
stream.Append( tmp );
break;
}
case wxPropertyValueIntegerPtr:
{
stream.Append( tmp );
break;
}
case wxPropertyValueIntegerPtr:
{
- tmp.Printf(
_
T("%ld"), *m_value.integerPtr );
+ tmp.Printf(
wx
T("%ld"), *m_value.integerPtr );
stream.Append( tmp );
break;
}
case wxPropertyValuebool:
{
if (m_value.integer)
stream.Append( tmp );
break;
}
case wxPropertyValuebool:
{
if (m_value.integer)
- stream.Append(
_
T("True") );
+ stream.Append(
wx
T("True") );
else
else
- stream.Append(
_
T("False") );
+ stream.Append(
wx
T("False") );
break;
}
case wxPropertyValueboolPtr:
{
if (*m_value.integerPtr)
break;
}
case wxPropertyValueboolPtr:
{
if (*m_value.integerPtr)
- stream.Append(
_
T("True") );
+ stream.Append(
wx
T("True") );
else
else
- stream.Append(
_
T("False") );
+ stream.Append(
wx
T("False") );
break;
}
case wxPropertyValueReal:
{
double d = m_value.real;
break;
}
case wxPropertyValueReal:
{
double d = m_value.real;
- tmp.Printf(
_
T("%.6g"), d );
+ tmp.Printf(
wx
T("%.6g"), d );
stream.Append( tmp );
break;
}
case wxPropertyValueRealPtr:
{
double d = *m_value.realPtr;
stream.Append( tmp );
break;
}
case wxPropertyValueRealPtr:
{
double d = *m_value.realPtr;
- tmp.Printf(
_
T("%.6g"), d );
+ tmp.Printf(
wx
T("%.6g"), d );
stream.Append( tmp );
break;
}
stream.Append( tmp );
break;
}
@@
-526,7
+538,7
@@
void wxPropertyValue::WritePropertyType(wxString& stream) // Write as any oth
}
case wxPropertyValueStringPtr:
{
}
case wxPropertyValueStringPtr:
{
- wxFAIL_MSG(
_
T("wxPropertyValue::WritePropertyType( wxPropertyValueStringPtr ) not implemented") );
+ wxFAIL_MSG(
wx
T("wxPropertyValue::WritePropertyType( wxPropertyValueStringPtr ) not implemented") );
/*
int i;
int len = strlen(*(m_value.stringPtr));
/*
int i;
int len = strlen(*(m_value.stringPtr));
@@
-541,20
+553,20
@@
void wxPropertyValue::WritePropertyType(wxString& stream) // Write as any oth
case wxPropertyValueList:
{
if (!m_value.first)
case wxPropertyValueList:
{
if (!m_value.first)
- stream.Append(
_
T("[]") );
+ stream.Append(
wx
T("[]") );
else
{
wxPropertyValue *expr = m_value.first;
else
{
wxPropertyValue *expr = m_value.first;
- stream.Append(
_
T("[") );
+ stream.Append(
wx
T("[") );
while (expr)
{
expr->WritePropertyType(stream);
expr = expr->m_next;
if (expr)
while (expr)
{
expr->WritePropertyType(stream);
expr = expr->m_next;
if (expr)
- stream.Append(
_
T(", ") );
+ stream.Append(
wx
T(", ") );
}
}
- stream.Append(
_
T("]") );
+ stream.Append(
wx
T("]") );
}
break;
}
}
break;
}
@@
-581,6
+593,14
@@
void wxPropertyValue::operator=(const wxString& val1)
const wxChar *val = (const wxChar *)val1;
m_modifiedFlag = TRUE;
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;
if (m_type == wxPropertyValueNull)
m_type = wxPropertyValueString;
@@
-593,8
+613,7
@@
void wxPropertyValue::operator=(const wxString& val1)
}
else if (m_type == wxPropertyValueStringPtr)
{
}
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
if (val)
*m_value.stringPtr = copystring(val);
else
@@
-609,6
+628,13
@@
void wxPropertyValue::operator=(const wxString& val1)
void wxPropertyValue::operator=(const long val)
{
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;
m_modifiedFlag = TRUE;
if (m_type == wxPropertyValueNull)
m_type = wxPropertyValueInteger;
@@
-628,6
+654,13
@@
void wxPropertyValue::operator=(const long val)
void wxPropertyValue::operator=(const bool val)
{
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;
m_modifiedFlag = TRUE;
if (m_type == wxPropertyValueNull)
m_type = wxPropertyValuebool;
@@
-643,6
+676,13
@@
void wxPropertyValue::operator=(const bool val)
void wxPropertyValue::operator=(const float val)
{
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;
m_modifiedFlag = TRUE;
if (m_type == wxPropertyValueNull)
m_type = wxPropertyValueReal;
@@
-662,6
+702,13
@@
void wxPropertyValue::operator=(const float val)
void wxPropertyValue::operator=(const wxChar **val)
{
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;
m_modifiedFlag = TRUE;
m_type = wxPropertyValueStringPtr;
@@
-1091,13
+1138,13
@@
bool wxPropertyValidator::StringToLong (wxChar *s, long *number) {
wxChar *wxPropertyValidator::FloatToString (float number) {
static wxChar buf[20];
wxChar *wxPropertyValidator::FloatToString (float number) {
static wxChar buf[20];
- wxSprintf (buf,
_
T("%.6g"), number);
+ wxSprintf (buf,
wx
T("%.6g"), number);
return buf;
}
wxChar *wxPropertyValidator::DoubleToString (double number) {
static wxChar buf[20];
return buf;
}
wxChar *wxPropertyValidator::DoubleToString (double number) {
static wxChar buf[20];
- wxSprintf (buf,
_
T("%.6g"), number);
+ wxSprintf (buf,
wx
T("%.6g"), number);
return buf;
}
return buf;
}