/////////////////////////////////////////////////////////////////////////////
-// Name: utilres.cpp
+// Name: src/gtk1/utilsres.cpp
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-//#ifdef __GNUG__
-//#pragma implementation "utils.h"
-//#endif
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
#include "wx/utils.h"
-#include "wx/string.h"
-#include "wx/list.h"
-#include "wx/log.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/list.h"
+ #include "wx/string.h"
+ #include "wx/log.h"
+ #include "wx/app.h"
+#endif
+
#include "wx/config.h"
-#include "wx/app.h"
//-----------------------------------------------------------------------------
// resource functions
bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file )
{
wxString filename( file );
- if (filename.IsEmpty()) filename = wxT(".wxWindows");
-
+ if (filename.empty()) filename = wxT(".wxWindows");
+
wxFileConfig conf( wxTheApp->GetAppName(), wxTheApp->GetVendorName(), filename );
-
+
conf.SetPath( section );
-
+
return conf.Write( entry, value );
}
return wxWriteResource(section, entry, buf, file);
}
-bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file )
+bool wxGetResource(const wxString& section, const wxString& entry, wxChar **value, const wxString& file )
{
wxString filename( file );
- if (filename.IsEmpty()) filename = wxT(".wxWindows");
-
+ if (filename.empty()) filename = wxT(".wxWindows");
+
wxFileConfig conf( wxTheApp->GetAppName(), wxTheApp->GetVendorName(), filename );
-
+
conf.SetPath( section );
-
+
wxString result;
- if (conf.Write( entry, &result ))
+ if (conf.Read( entry, &result ))
{
- if (!result.IsEmpty())
- {
- char *s = new char[result.Len()+1];
- wxStrcpy( s, result.c_str() );
- *value = s;
- return TRUE;
- }
+ if (!result.empty())
+ {
+ wxChar *s = new wxChar[result.Len()+1];
+ wxStrcpy( s, result.c_str() );
+ *value = s;
+ return true;
+ }
}
-
- return FALSE;
+
+ return false;
}
bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file )
{
*value = (float)wxStrtod(s, NULL);
delete[] s;
- return TRUE;
+ return true;
}
- else return FALSE;
+ else return false;
}
bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file )
{
*value = wxStrtol(s, NULL, 10);
delete[] s;
- return TRUE;
+ return true;
}
- else return FALSE;
+ else return false;
}
bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file )
{
*value = (int)wxStrtol(s, NULL, 10);
delete[] s;
- return TRUE;
+ return true;
}
- else return FALSE;
+ else return false;
}
-