My favorites | Sign in
Project Home Downloads Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef FORM_EDITOR_COMMON__UTILS_H
#define FORM_EDITOR_COMMON__UTILS_H

#include <CtrlLib/CtrlLib.h>
using namespace Upp;

// Returns fullpath to the file in the exe-file directory
inline String ConfigFileEx(const char* fp)
{
return AppendFileName( GetFileDirectory(GetExeFilePath()), String(fp) );
}

// Converts const char* text to String
inline String AsString(const char* s) { return String(s); }

// Saves Image to String
inline String AsString(Image mIcon)
{
return StoreAsString(mIcon);
}

// Loads Image from String
inline Image ToImage(const String& icon)
{
Image r;
return LoadFromString(r, icon) ? r : Image();
}

// Returns the bool-value from any type of value
inline bool ToBool(const Value& v)
{
if (v.GetType() == BOOL_V) return (bool)v;
else return v.ToString() == "true" || ScanInt(v.ToString()) == 1;
}

// Extended VectorMap, supports adding elements in one line
template <class U, class T> class VectorMapEx : public VectorMap<U, T>
{
public:
virtual ~VectorMapEx() {}
VectorMapEx<U, T>& Add(const U& u, const T& t)
{
VectorMap<U, T>::Add(u, t);
return *this;
}
};

#endif

Change log

r4180 by Sc0rch on Nov 17, 2011   Diff
MapRender: First release
(FormEditorCommon, FormEditorProperties,
Map, MapBG, MapCommon, MapEditor,
MapRenderTest.
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 1158 bytes, 48 lines
Powered by Google Project Hosting