Nux

Merge lp:~michihenning/nux/nstring into lp:nux

Proposed by Michi Henning
Status: Merged
Merged at revision: 687
Proposed branch: lp:~michihenning/nux/nstring
Merge into: lp:nux
Diff against target: 6262 lines (+1031/-1318) (has conflicts)
86 files modified
Nux/ActionItem.cpp (+1/-1)
Nux/ActionItem.h (+1/-1)
Nux/BaseWindow.h (+2/-2)
Nux/ColorPreview.cpp (+9/-2)
Nux/DoubleValidator.cpp (+7/-3)
Nux/DoubleValidator.h (+1/-1)
Nux/EditTextBox.cpp (+62/-46)
Nux/EditTextBox.h (+12/-22)
Nux/FileSelector.cpp (+2/-2)
Nux/FloatingWindow.cpp (+5/-5)
Nux/FloatingWindow.h (+2/-2)
Nux/HLayout.cpp (+1/-1)
Nux/HLayout.h (+1/-1)
Nux/HexRegExpValidator.cpp (+2/-3)
Nux/HexRegExpValidator.h (+1/-1)
Nux/IntegerValidator.cpp (+2/-3)
Nux/IntegerValidator.h (+1/-1)
Nux/KeyboardHandler.cpp (+58/-63)
Nux/KeyboardHandler.h (+7/-8)
Nux/Layout.h (+1/-1)
Nux/MenuPage.cpp (+1/-1)
Nux/MenuPage.h (+1/-1)
Nux/NumericValuator.cpp (+7/-5)
Nux/PangoText.cpp (+1/-1)
Nux/RGBValuator.cpp (+61/-37)
Nux/RGBValuator.h (+1/-1)
Nux/RangeValue.cpp (+13/-6)
Nux/RangeValue.h (+1/-1)
Nux/RangeValueInteger.cpp (+6/-6)
Nux/RangeValueInteger.h (+1/-1)
Nux/SpinBox.cpp (+4/-4)
Nux/SpinBoxDouble.cpp (+4/-4)
Nux/StaticTextBox.cpp (+9/-21)
Nux/StaticTextBox.h (+3/-5)
Nux/SystemThread.h (+1/-1)
Nux/TabView.cpp (+3/-3)
Nux/TabView.h (+3/-3)
Nux/Theme.cpp (+16/-16)
Nux/VLayout.cpp (+1/-1)
Nux/VLayout.h (+1/-1)
Nux/Validator.cpp (+3/-3)
Nux/Validator.h (+1/-1)
Nux/WindowCompositor.cpp (+8/-8)
Nux/WindowCompositor.h (+1/-1)
NuxCore/FileIO.cpp (+9/-9)
NuxCore/FileIO.h (+5/-2)
NuxCore/FileManager/NFileManagerGNU.h (+4/-4)
NuxCore/FileManager/NFileManagerGeneric.cpp (+15/-15)
NuxCore/FileManager/NFileManagerGeneric.h (+7/-8)
NuxCore/FileName.cpp (+96/-98)
NuxCore/FileName.h (+12/-15)
NuxCore/FilePath.cpp (+36/-34)
NuxCore/FilePath.h (+5/-5)
NuxCore/NumberConversion.cpp (+13/-10)
NuxCore/NumberConversion.h (+4/-6)
NuxCore/OutputDevice.cpp (+36/-18)
NuxCore/OutputDevice.h (+1/-1)
NuxCore/Parsing.cpp (+8/-8)
NuxCore/Parsing.h (+8/-8)
NuxCore/Platform.cpp (+21/-21)
NuxCore/Platform.h (+10/-10)
NuxCore/TextString.cpp (+6/-19)
NuxCore/TextString.h (+0/-236)
NuxCore/TimeFunctions.cpp (+3/-3)
NuxCore/TimeFunctions.h (+1/-1)
NuxGraphics/FontTexture.cpp (+14/-18)
NuxGraphics/FontTexture.h (+4/-4)
NuxGraphics/GLSh_ColorPicker.cpp (+21/-21)
NuxGraphics/GLSh_DrawFunction.cpp (+8/-8)
NuxGraphics/GLShaderParameter.h (+1/-1)
NuxGraphics/GpuDevice.cpp (+19/-16)
NuxGraphics/GpuDevice.h (+4/-4)
NuxGraphics/GraphicsDisplayWin.cpp (+1/-1)
NuxGraphics/GraphicsDisplayX11.cpp (+12/-12)
NuxGraphics/GraphicsDisplayX11.h (+14/-10)
NuxGraphics/GraphicsEngine.cpp (+6/-6)
NuxGraphics/IOpenGLAsmShader.cpp (+7/-7)
NuxGraphics/IOpenGLAsmShader.h (+2/-2)
NuxGraphics/IOpenGLGLSLShader.cpp (+48/-46)
NuxGraphics/IOpenGLGLSLShader.h (+8/-8)
NuxGraphics/NuxGraphics.h (+2/-2)
NuxGraphics/NuxGraphicsResources.cpp (+24/-101)
NuxGraphics/NuxGraphicsResources.h (+7/-7)
NuxGraphics/RenderingPipeAsm.cpp (+90/-90)
NuxGraphics/RenderingPipeGLSL.cpp (+95/-98)
NuxGraphics/RenderingPipeTextureBlend.cpp (+15/-24)
Text conflict in NuxCore/TextString.cpp
Text conflict in NuxGraphics/GraphicsDisplayX11.h
Text conflict in NuxGraphics/RenderingPipeGLSL.cpp
To merge this branch: bzr merge lp:~michihenning/nux/nstring
Reviewer Review Type Date Requested Status
Jay Taoko Pending
Review via email: mp+126380@code.launchpad.net

Description of the change

This set of changes removes NString from the Nux code base. NString.h still exists, but only for the helper functions it defines. The NString class itself is gone.

Unfortunately, these changes are quite large because NString was used a lot. The good news is that Unity has only a handful of places where NString shows up, so it'll be easy to make Unity work again after this change.

I have mostly used standard library features to do things that used to be methods on NString, even when there was no directly equivalent on std::string. In a few places, that added a few lines of code but, mostly, methods on std::string were sufficient. In a few places, I used Boost string algorithms where there was no convenient and short way to do something with just std::string methods (such tokenizing).

This builds OK on Ubuntu and the tests still pass. I don't have a Windows environment, so I left code that is conditionally compiled for Windows alone. I suspect that it won't be too difficult to make the corresponding Windows changes by looking at what I did in the corresponding Linux code, but it'll still be tedious, sorry.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Nux/ActionItem.cpp'
2--- Nux/ActionItem.cpp 2011-12-14 02:01:43 +0000
3+++ Nux/ActionItem.cpp 2012-09-26 05:32:20 +0000
4@@ -133,7 +133,7 @@
5
6 const char *ActionItem::GetLabel() const
7 {
8- return m_Label.GetTCharPtr();
9+ return m_Label.c_str();
10 }
11
12 void ActionItem::SetIcon(const BaseTexture* icon)
13
14=== modified file 'Nux/ActionItem.h'
15--- Nux/ActionItem.h 2011-04-06 21:54:09 +0000
16+++ Nux/ActionItem.h 2012-09-26 05:32:20 +0000
17@@ -67,7 +67,7 @@
18 //! A value defined by the user at construction time.
19 int m_UserValue;
20 BaseTexture* m_Icon;
21- NString m_Label;
22+ std::string m_Label;
23 bool m_IsActivated;
24 MenuPage *m_Menu;
25 bool m_Enable;
26
27=== modified file 'Nux/BaseWindow.h'
28--- Nux/BaseWindow.h 2012-08-07 20:39:44 +0000
29+++ Nux/BaseWindow.h 2012-09-26 05:32:20 +0000
30@@ -186,7 +186,7 @@
31 //! Emit a signal when the BaseWindow becomes hidden.
32 sigc::signal<void, BaseWindow*> sigHidden;
33
34- NString GetWindowName()
35+ std::string GetWindowName()
36 {
37 return _name;
38 }
39@@ -252,7 +252,7 @@
40 //! Contains the background of the texture. Can be used to blur. It is set by the window compositor.
41 ObjectPtr<BaseTexture> _background_texture;
42
43- NString _name;
44+ std::string _name;
45 bool _size_match_layout;
46 bool _is_visible;
47 bool _is_modal;
48
49=== modified file 'Nux/ColorPreview.cpp'
50--- Nux/ColorPreview.cpp 2012-08-17 12:41:21 +0000
51+++ Nux/ColorPreview.cpp 2012-09-26 05:32:20 +0000
52@@ -27,6 +27,9 @@
53 #include "TimerProc.h"
54 #include "StaticTextBox.h"
55
56+#include <sstream>
57+#include <iomanip>
58+
59 namespace nux
60 {
61
62@@ -50,8 +53,12 @@
63 m_ColorValue->SetFont(GetSysBoldFont());
64 m_ColorValue->SetMinimumWidth(128);
65
66- NString text = NString::Printf("[ R:%d, G:%d, B:%d ]", (int) (m_Color.red * 255), (int) (m_Color.green * 255), (int) (m_Color.blue * 255));
67- m_ColorValue->SetText(text);
68+ std::stringstream s;
69+ s << "[ R:" << (int)(m_Color.red * 255)
70+ << ", G:" << (int)(m_Color.green * 255)
71+ << ", B:" << (int)(m_Color.blue * 255)
72+ << " ]";
73+ m_ColorValue->SetText(s.str());
74
75 m_ColorArea->mouse_click.connect(sigc::mem_fun(this, &ColorPreview::RecvClick));
76
77
78=== modified file 'Nux/DoubleValidator.cpp'
79--- Nux/DoubleValidator.cpp 2012-09-19 04:53:45 +0000
80+++ Nux/DoubleValidator.cpp 2012-09-26 05:32:20 +0000
81@@ -23,6 +23,9 @@
82 #include "Nux.h"
83 #include "DoubleValidator.h"
84
85+#include <sstream>
86+#include <iomanip>
87+
88 namespace nux
89 {
90
91@@ -127,10 +130,11 @@
92 m_Decimals = Clamp<int> (dec, 0, 13);
93 }
94
95- NString DoubleValidator::ToString(double d)
96+ std::string DoubleValidator::ToString(double d)
97 {
98- NString Prec = NString("%.") + NString::Printf("%d", m_Decimals) + NString("f");
99- return NString::Printf(Prec.GetTCharPtr(), d);
100+ std::stringstream s;
101+ s << std::setprecision(m_Decimals) << d;
102+ return s.str();
103 }
104
105 double DoubleValidator::ToDouble(const char *str)
106
107=== modified file 'Nux/DoubleValidator.h'
108--- Nux/DoubleValidator.h 2011-10-17 21:23:50 +0000
109+++ Nux/DoubleValidator.h 2012-09-26 05:32:20 +0000
110@@ -52,7 +52,7 @@
111 void SetMaximum(double value);
112 double GetMaximum() const;
113
114- NString ToString(double d);
115+ std::string ToString(double d);
116 double ToDouble(const char *str);
117
118 private:
119
120=== modified file 'Nux/EditTextBox.cpp'
121--- Nux/EditTextBox.cpp 2012-09-17 09:55:43 +0000
122+++ Nux/EditTextBox.cpp 2012-09-26 05:32:20 +0000
123@@ -160,7 +160,7 @@
124 {
125
126 GetPainter().PaintColorTextLineEdit(graphics_engine, GetGeometry(),
127- m_KeyboardHandler.GetTextLine().m_string,
128+ m_KeyboardHandler.GetTextLine(),
129 GetTextColor(),
130 m_WriteAlpha,
131 m_SelectedTextColor,
132@@ -177,7 +177,7 @@
133 else
134 {
135 GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), GetGeometry(),
136- m_KeyboardHandler.GetTextLine().m_string,
137+ m_KeyboardHandler.GetTextLine(),
138 GetTextColor());
139 }
140 }
141@@ -194,34 +194,30 @@
142
143 }
144
145- void EditTextBox::SetText(const char &Caption)
146- {
147- NString s(Caption);
148- SetText(s);
149- }
150-
151 void EditTextBox::SetText(const char *Caption)
152 {
153- NString s(Caption);
154- SetText(s);
155- }
156-
157- void EditTextBox::SetText(const tstring &Caption)
158- {
159- NString s(Caption);
160- SetText(s);
161- }
162-
163- void EditTextBox::SetText(const NString &Caption)
164- {
165- NString s(Caption);
166- s.RemovePrefix(m_Prefix);
167- s.RemoveSuffix(m_Suffix);
168-
169- if (ValidateKeyboardEntry(s.GetTCharPtr()))
170+ std::string s(Caption);
171+ SetText(s);
172+ }
173+
174+ void EditTextBox::SetText(const std::string &Caption)
175+ {
176+ std::string s(Caption);
177+ size_t pos = s.find(m_Prefix, 0);
178+ if (pos == 0)
179+ {
180+ s.erase(0, m_Prefix.size());
181+ }
182+ pos = s.rfind(m_Suffix);
183+ if (pos != std::string::npos && pos == s.size() - m_Suffix.size())
184+ {
185+ s.erase(pos);
186+ }
187+
188+ if (ValidateKeyboardEntry(s.c_str()))
189 {
190 m_Text = (m_Prefix + s) + m_Suffix;
191- m_KeyboardHandler.SetText(m_Text.GetTStringRef());
192+ m_KeyboardHandler.SetText(m_Text);
193 m_temporary_caption = m_Text;
194 sigSetText.emit(this);
195 }
196@@ -232,16 +228,24 @@
197
198 const char *EditTextBox::GetText() const
199 {
200- return m_Text.GetTCharPtr();
201+ return m_Text.c_str();
202 }
203
204 //! Return a caption string striping out the prefix and the suffix
205- NString EditTextBox::GetCleanText() const
206+ std::string EditTextBox::GetCleanText() const
207 {
208- NString CleanText(m_Text);
209- CleanText.RemovePrefix(m_Prefix);
210- CleanText.RemoveSuffix(m_Suffix);
211- return CleanText.m_string;
212+ std::string CleanText(m_Text);
213+ size_t pos = CleanText.find(m_Prefix, 0);
214+ if (pos == 0)
215+ {
216+ CleanText.erase(0, m_Prefix.size());
217+ }
218+ pos = CleanText.rfind(m_Suffix);
219+ if (pos != std::string::npos && pos == CleanText.size() - m_Suffix.size())
220+ {
221+ CleanText.erase(pos);
222+ }
223+ return CleanText;
224 }
225
226 void EditTextBox::RecvMouseDoubleClick(int x, int y, unsigned long button_flags, unsigned long key_flags)
227@@ -342,10 +346,14 @@
228
229 if (keysym == NUX_VK_ENTER || keysym == NUX_KP_ENTER)
230 {
231- NString str(m_KeyboardHandler.GetTextLine());
232- str.RemoveSuffix(m_Suffix);
233+ std::string str(m_KeyboardHandler.GetTextLine());
234+ size_t pos = str.rfind(m_Suffix);
235+ if (pos != std::string::npos && pos == str.size() - m_Suffix.size())
236+ {
237+ str.erase(pos);
238+ }
239
240- if (ValidateKeyboardEntry(str.m_string.c_str()))
241+ if (ValidateKeyboardEntry(str.c_str()))
242 {
243 m_Text = m_KeyboardHandler.GetTextLine();
244 m_temporary_caption = m_Text;
245@@ -397,7 +405,7 @@
246
247 void EditTextBox::EnteringKeyboardFocus()
248 {
249- m_KeyboardHandler.SetText(m_Text.GetTStringRef());
250+ m_KeyboardHandler.SetText(m_Text);
251 m_KeyboardHandler.SelectAllText();
252 // Preserve the current caption text. If ESC is pressed while we have keyboard focus then
253 // the previous caption text is restored
254@@ -408,25 +416,33 @@
255
256 void EditTextBox::QuitingKeyboardFocus()
257 {
258- NString CleanText(m_KeyboardHandler.GetTextLine());
259- CleanText.RemovePrefix(m_Prefix);
260- CleanText.RemoveSuffix(m_Suffix);
261+ std::string CleanText(m_KeyboardHandler.GetTextLine());
262+ size_t pos = CleanText.find(m_Prefix, 0);
263+ if (pos == 0)
264+ {
265+ CleanText.erase(0, m_Prefix.size());
266+ }
267+ pos = CleanText.rfind(m_Suffix);
268+ if (pos != std::string::npos && pos == CleanText.size() - m_Suffix.size())
269+ {
270+ CleanText.erase(pos);
271+ }
272
273- if (ValidateKeyboardEntry(CleanText.GetTCharPtr()))
274+ if (ValidateKeyboardEntry(CleanText.c_str()))
275 {
276 CleanText = m_Prefix + CleanText;
277 CleanText = CleanText + m_Suffix;
278
279- m_Text = CleanText.m_string; //m_KeyboardHandler.GetTextLine();
280- m_KeyboardHandler.SetText(CleanText.m_string);
281+ m_Text = CleanText; //m_KeyboardHandler.GetTextLine();
282+ m_KeyboardHandler.SetText(CleanText);
283 m_temporary_caption = m_Text;
284- sigValidateKeyboardEntry.emit(this, m_Text.GetTStringRef());
285+ sigValidateKeyboardEntry.emit(this, m_Text);
286 sigValidateEntry.emit(this);
287 }
288 else
289 {
290 m_Text = m_temporary_caption;
291- m_KeyboardHandler.SetText(m_Text.GetTStringRef());
292+ m_KeyboardHandler.SetText(m_Text);
293 m_KeyboardHandler.SelectAllText();
294 }
295
296@@ -455,12 +471,12 @@
297
298 void EditTextBox::SetDoubleValue(double d)
299 {
300- SetText(NString::Printf("%f", d));
301+ SetText(std::to_string(d));
302 }
303
304 void EditTextBox::SetIntegerValue(int i)
305 {
306- SetText(NString::Printf("%d", i));
307+ SetText(std::to_string(i));
308 }
309
310 void EditTextBox::SetTextBackgroundColor(const Color &color)
311
312=== modified file 'Nux/EditTextBox.h'
313--- Nux/EditTextBox.h 2011-11-10 17:28:44 +0000
314+++ Nux/EditTextBox.h 2012-09-26 05:32:20 +0000
315@@ -50,21 +50,19 @@
316 unsigned int keysym,
317 const char* character);
318
319- void SetText(const char &Caption);
320 void SetText(const char *Caption);
321- void SetText(const tstring &Caption);
322- void SetText(const NString &Caption);
323+ void SetText(const std::string &Caption);
324 const char *GetText() const;
325 unsigned int GetTextSize() const
326 {
327- return (unsigned int) m_Text.Length();
328+ return (unsigned int) m_Text.length();
329 }
330
331 void SetDoubleValue(double d);
332 void SetIntegerValue(int i);
333
334 //! Return a caption string striping out the prefix and the suffix
335- virtual NString GetCleanText() const;
336+ virtual std::string GetCleanText() const;
337
338 void SetTextBackgroundColor(const Color &color);
339 Color GetTextBackgroundColor() const;
340@@ -128,10 +126,6 @@
341 void RecvEndKeyFocus();
342
343
344- void SetPrefix(const tstring &p)
345- {
346- m_Prefix = p;
347- };
348 void SetPrefix(const char *p)
349 {
350 m_Prefix = p;
351@@ -140,19 +134,15 @@
352 {
353 m_Prefix = p;
354 };
355- void SetPrefix(const NString &p)
356+ void SetPrefix(const std::string &p)
357 {
358 m_Prefix = p;
359 };
360- NString GetPrefix() const
361+ std::string GetPrefix() const
362 {
363 return m_Prefix;
364 };
365
366- void SetSuffix(const tstring &s)
367- {
368- m_Suffix = s;
369- };
370 void SetSuffix(const char *s)
371 {
372 m_Suffix = s;
373@@ -161,11 +151,11 @@
374 {
375 m_Suffix = s;
376 };
377- void SetSuffix(const NString &s)
378+ void SetSuffix(const std::string &s)
379 {
380 m_Suffix = s;
381 };
382- NString Getsuffix() const
383+ std::string Getsuffix() const
384 {
385 return m_Suffix;
386 };
387@@ -175,7 +165,7 @@
388 sigc::signal< void, EditTextBox *, unsigned int > sigCharacter; // Emitted every time a character typed
389 sigc::signal< void, EditTextBox * > sigEditChange; // Emitted every time a character typed
390
391- sigc::signal< void, EditTextBox *, const NString &> sigValidateKeyboardEntry;
392+ sigc::signal< void, EditTextBox *, const std::string &> sigValidateKeyboardEntry;
393 sigc::signal< void, EditTextBox * > sigValidateEntry; // Emitted when the text is validated
394 sigc::signal< void, EditTextBox * > sigSetText; // Emitted when text is set with setCaption
395 sigc::signal< void, EditTextBox * > sigEscapeKeyboardFocus;
396@@ -196,7 +186,7 @@
397
398 virtual long PostLayoutManagement(long LayoutResult);
399
400- NString m_Text;
401+ std::string m_Text;
402 HLayout *hlayout;
403
404 Color m_BackgroundColor;
405@@ -206,12 +196,12 @@
406 Color m_CursorColor;
407
408 BaseKeyboardHandler m_KeyboardHandler;
409- NString m_temporary_caption;
410+ std::string m_temporary_caption;
411 BaseKeyboardHandler::eKeyEntryType m_keytype;
412
413 Validator *m_Validator;
414- NString m_Suffix;
415- NString m_Prefix;
416+ std::string m_Suffix;
417+ std::string m_Prefix;
418
419 bool BlinkCursor;
420 void BlinkCursorTimerInterrupt(void *v);
421
422=== modified file 'Nux/FileSelector.cpp'
423--- Nux/FileSelector.cpp 2011-10-10 01:52:00 +0000
424+++ Nux/FileSelector.cpp 2012-09-26 05:32:20 +0000
425@@ -53,9 +53,9 @@
426 SetMinimumSize(DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT);
427 SetLayout(m_hlayout);
428
429- NString Path = NUX_FINDRESOURCELOCATION("Icons/Folder-16x16.png");
430+ std::string Path = NUX_FINDRESOURCELOCATION("Icons/Folder-16x16.png");
431 m_Texture = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableTexture();
432- m_Texture->Update(Path.GetTCharPtr());
433+ m_Texture->Update(Path.c_str());
434 }
435
436 FileSelector::~FileSelector()
437
438=== modified file 'Nux/FloatingWindow.cpp'
439--- Nux/FloatingWindow.cpp 2012-09-17 09:55:43 +0000
440+++ Nux/FloatingWindow.cpp 2012-09-26 05:32:20 +0000
441@@ -98,12 +98,12 @@
442 SetMinimumSize(32, 32);
443 SetGeometry(Geometry(100, 100, 320, 200));
444
445- NString Path = NUX_FINDRESOURCELOCATION("UITextures/AddButton.png");
446+ std::string Path = NUX_FINDRESOURCELOCATION("UITextures/AddButton.png");
447 MinimizeIcon = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableTexture();
448- MinimizeIcon->Update(Path.GetTCharPtr());
449+ MinimizeIcon->Update(Path.c_str());
450 Path = NUX_FINDRESOURCELOCATION("UITextures/CancelButton.png");
451 CloseIcon = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableTexture();
452- CloseIcon->Update(Path.GetTCharPtr());
453+ CloseIcon->Update(Path.c_str());
454
455 SetWindowTitle(WindowName);
456 }
457@@ -178,7 +178,7 @@
458 _title_bar->GetBaseWidth(), _title_bar->GetBaseHeight()), Color(0xFF2f2f2f),
459 eSHAPE_CORNER_ROUND10, eCornerTopLeft | eCornerTopRight);
460
461- GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), _window_title_bar->GetGeometry(), _window_title.m_string, Color(0xFFFFFFFF), true, eAlignTextCenter);
462+ GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), _window_title_bar->GetGeometry(), _window_title, Color(0xFFFFFFFF), true, eAlignTextCenter);
463 GetPainter().Draw2DTextureAligned(graphics_engine, CloseIcon, _close_button->GetGeometry(), TextureAlignmentStyle(eTACenter, eTACenter));
464 }
465
466@@ -472,7 +472,7 @@
467 _window_title = title;
468 }
469
470- NString FloatingWindow::GetWindowTitle()
471+ std::string FloatingWindow::GetWindowTitle()
472 {
473 return _window_title;
474 }
475
476=== modified file 'Nux/FloatingWindow.h'
477--- Nux/FloatingWindow.h 2012-08-17 12:41:21 +0000
478+++ Nux/FloatingWindow.h 2012-09-26 05:32:20 +0000
479@@ -71,7 +71,7 @@
480 void RecvTitleBarMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
481
482 void SetWindowTitle(const char *title);
483- NString GetWindowTitle();
484+ std::string GetWindowTitle();
485
486 //! Return true if this object can break the layout.
487 /*
488@@ -134,7 +134,7 @@
489 std::list<View *> m_InterfaceObject;
490 HLayout *_title_bar_layout;
491
492- NString _window_title;
493+ std::string _window_title;
494
495 friend class PopUpWindow;
496 friend class ComboBox_Logic_WindowView;
497
498=== modified file 'Nux/HLayout.cpp'
499--- Nux/HLayout.cpp 2011-12-10 06:39:14 +0000
500+++ Nux/HLayout.cpp 2012-09-26 05:32:20 +0000
501@@ -48,7 +48,7 @@
502 m_ContentStacking = eStackLeft;
503 }
504
505- HLayout::HLayout(NString name, NUX_FILE_LINE_DECL)
506+ HLayout::HLayout(std::string name, NUX_FILE_LINE_DECL)
507 : LinearLayout(NUX_FILE_LINE_PARAM)
508 {
509 m_name = name;
510
511=== modified file 'Nux/HLayout.h'
512--- Nux/HLayout.h 2011-10-21 22:06:35 +0000
513+++ Nux/HLayout.h 2012-09-26 05:32:20 +0000
514@@ -33,7 +33,7 @@
515 NUX_DECLARE_OBJECT_TYPE(HLayout, LinearLayout);
516 public:
517 HLayout(NUX_FILE_LINE_PROTO);
518- HLayout(NString name, NUX_FILE_LINE_PROTO);
519+ HLayout(std::string name, NUX_FILE_LINE_PROTO);
520 ~HLayout();
521
522 virtual long ComputeContentSize();
523
524=== modified file 'Nux/HexRegExpValidator.cpp'
525--- Nux/HexRegExpValidator.cpp 2012-09-19 04:53:45 +0000
526+++ Nux/HexRegExpValidator.cpp 2012-09-26 05:32:20 +0000
527@@ -121,10 +121,9 @@
528 {
529 }
530
531- NString HexRegExpValidator::ToString(int i)
532+ std::string HexRegExpValidator::ToString(int i)
533 {
534- NString Prec("%d");
535- return NString::Printf(Prec.GetTCharPtr(), i);
536+ return std::to_string(i);
537 }
538
539 int HexRegExpValidator::ToInteger(const char *str)
540
541=== modified file 'Nux/HexRegExpValidator.h'
542--- Nux/HexRegExpValidator.h 2011-10-17 21:23:50 +0000
543+++ Nux/HexRegExpValidator.h 2012-09-26 05:32:20 +0000
544@@ -50,7 +50,7 @@
545 void SetMaximum(int value);
546 int GetMaximum() const;
547
548- NString ToString(int i);
549+ std::string ToString(int i);
550 int ToInteger(const char *str);
551
552 private:
553
554=== modified file 'Nux/IntegerValidator.cpp'
555--- Nux/IntegerValidator.cpp 2012-09-19 04:53:45 +0000
556+++ Nux/IntegerValidator.cpp 2012-09-26 05:32:20 +0000
557@@ -122,10 +122,9 @@
558 {
559 }
560
561- NString IntegerValidator::ToString(int i)
562+ std::string IntegerValidator::ToString(int i)
563 {
564- NString Prec("%d");
565- return NString::Printf(Prec.GetTCharPtr(), i);
566+ return std::to_string(i);
567 }
568
569 int IntegerValidator::ToInteger(const char *str)
570
571=== modified file 'Nux/IntegerValidator.h'
572--- Nux/IntegerValidator.h 2011-10-17 21:23:50 +0000
573+++ Nux/IntegerValidator.h 2012-09-26 05:32:20 +0000
574@@ -49,7 +49,7 @@
575 void SetMaximum(int value);
576 int GetMaximum() const;
577
578- NString ToString(int i);
579+ std::string ToString(int i);
580 int ToInteger(const char *str);
581
582 private:
583
584=== modified file 'Nux/KeyboardHandler.cpp'
585--- Nux/KeyboardHandler.cpp 2011-10-21 22:06:35 +0000
586+++ Nux/KeyboardHandler.cpp 2012-09-26 05:32:20 +0000
587@@ -63,7 +63,7 @@
588
589 // Remove the characters
590 for (int i = nFirst; i < nLast; ++i)
591- m_textline.Erase(nFirst, 1);
592+ m_textline.erase(nFirst, 1);
593 }
594
595 void BaseKeyboardHandler::InsertChar(unsigned int character)
596@@ -78,19 +78,19 @@
597 m_caret = 0;
598
599 m_previous_cursor_position = 0;
600- m_textline.Clear();
601+ m_textline.clear();
602 }
603
604 void BaseKeyboardHandler::PlaceCaret(unsigned int nCP)
605 {
606- nuxAssert((nCP >= 0) && (nCP <= (unsigned int) m_textline.Length()));
607+ nuxAssert((nCP >= 0) && (nCP <= (unsigned int) m_textline.length()));
608 m_previous_cursor_position = m_caret;
609 m_caret = nCP;
610 }
611
612 unsigned int BaseKeyboardHandler::NextWordPosition(unsigned int cp)
613 {
614- unsigned int num_char = (unsigned int) m_textline.Length();
615+ unsigned int num_char = (unsigned int) m_textline.length();
616
617 if (cp == num_char)
618 return cp;
619@@ -159,10 +159,10 @@
620 if (m_entering_focus)
621 return;
622
623- if (m_textline.Length() == 0)
624+ if (m_textline.length() == 0)
625 return;
626
627- unsigned int StrLength = (unsigned int) m_textline.Length();
628+ unsigned int StrLength = (unsigned int) m_textline.length();
629 int total = m_text_positionx;
630 unsigned int nCP = StrLength;
631
632@@ -210,17 +210,17 @@
633 if (m_entering_focus)
634 return;
635
636- if (m_textline.Length() == 0)
637+ if (m_textline.length() == 0)
638 return;
639
640- int StrLength = (int) m_textline.Length();
641+ int StrLength = (int) m_textline.length();
642
643 //nuxDebugMsg("[BaseKeyboardHandler::ResolveCaretPosition]");
644 if (x < geo.x)
645 {
646 if (m_mouse_inside_text_area)
647 {
648- while (m_caret && (GetFont()->GetCharStringWidth(m_textline.GetTCharPtr(), m_caret) + m_text_positionx > 0))
649+ while (m_caret && (GetFont()->GetCharStringWidth(m_textline.c_str(), m_caret) + m_text_positionx > 0))
650 {
651 --m_caret;
652 //nuxDebugMsg("Group Add: %c", m_textline[m_caret]);
653@@ -242,7 +242,7 @@
654 {
655 if (m_mouse_inside_text_area)
656 {
657- while ((m_caret != StrLength) && (GetFont()->GetCharStringWidth(m_textline.GetTCharPtr(), m_caret) + m_text_positionx < geo.GetWidth()))
658+ while ((m_caret != StrLength) && (GetFont()->GetCharStringWidth(m_textline.c_str(), m_caret) + m_text_positionx < geo.GetWidth()))
659 {
660 ++m_caret;
661 //nuxDebugMsg("Group Add: %c", m_textline[m_caret-1]);
662@@ -311,7 +311,7 @@
663 // If we are in overwrite mode and there is already
664 // a char at the caret's position, simply replace it.
665 // Otherwise, we insert the char as normal.
666- if ( !m_insert_mode && m_caret < (int) m_textline.Length())
667+ if ( !m_insert_mode && m_caret < (int) m_textline.length())
668 {
669 m_textline[m_caret] = key;
670 PlaceCaret(m_caret + 1 );
671@@ -320,9 +320,9 @@
672 else
673 {
674 // Insert the char
675- if ( m_caret <= (int) m_textline.Length())
676+ if ( m_caret <= (int) m_textline.length())
677 {
678- m_textline.Insert(m_caret, 1, key);
679+ m_textline.insert(m_caret, 1, key);
680 PlaceCaret(m_caret + 1 );
681 m_selection_start = m_caret;
682 }
683@@ -334,7 +334,7 @@
684 // If we are in overwrite mode and there is already
685 // a char at the caret's position, simply replace it.
686 // Otherwise, we insert the char as normal.
687- if ( !m_insert_mode && m_caret < (int) m_textline.Length())
688+ if ( !m_insert_mode && m_caret < (int) m_textline.length())
689 {
690 m_textline[m_caret] = key;
691 PlaceCaret(m_caret + 1 );
692@@ -343,9 +343,9 @@
693 else
694 {
695 // Insert the char
696- if ( m_caret <= (int) m_textline.Length())
697+ if ( m_caret <= (int) m_textline.length())
698 {
699- m_textline.Insert(m_caret, 1, key);
700+ m_textline.insert(m_caret, 1, key);
701 PlaceCaret(m_caret + 1 );
702 m_selection_start = m_caret;
703 }
704@@ -371,7 +371,7 @@
705 // If we are in overwrite mode and there is already
706 // a char at the caret's position, simply replace it.
707 // Otherwise, we insert the char as normal.
708- if (!m_insert_mode && (m_caret < (int) m_textline.Length()))
709+ if (!m_insert_mode && (m_caret < (int) m_textline.length()))
710 {
711 m_textline[m_caret] = key;
712 PlaceCaret(m_caret + 1 );
713@@ -380,9 +380,9 @@
714 else
715 {
716 // Insert the char
717- if ( m_caret <= (int) m_textline.Length())
718+ if ( m_caret <= (int) m_textline.length())
719 {
720- m_textline.Insert(m_caret, 1, key);
721+ m_textline.insert(m_caret, 1, key);
722 PlaceCaret(m_caret + 1 );
723 m_selection_start = m_caret;
724 }
725@@ -393,7 +393,7 @@
726 // If we are in overwrite mode and there is already
727 // a char at the caret's position, simply replace it.
728 // Otherwise, we insert the char as normal.
729- if (!m_insert_mode && (m_caret < (int) m_textline.Length()))
730+ if (!m_insert_mode && (m_caret < (int) m_textline.length()))
731 {
732 m_textline[m_caret] = key;
733 PlaceCaret(m_caret + 1 );
734@@ -402,9 +402,9 @@
735 else
736 {
737 // Insert the char
738- if (m_caret <= (int) m_textline.Length())
739+ if (m_caret <= (int) m_textline.length())
740 {
741- m_textline.Insert(m_caret, 1, key);
742+ m_textline.insert(m_caret, 1, key);
743 PlaceCaret(m_caret + 1 );
744 m_selection_start = m_caret;
745 }
746@@ -428,7 +428,7 @@
747 // If we are in overwrite mode and there is already
748 // a char at the caret's position, simply replace it.
749 // Otherwise, we insert the char as normal.
750- if (!m_insert_mode && (m_caret < (int) m_textline.Length()))
751+ if (!m_insert_mode && (m_caret < (int) m_textline.length()))
752 {
753 m_textline[m_caret] = key;
754 PlaceCaret(m_caret + 1 );
755@@ -437,9 +437,9 @@
756 else
757 {
758 // Insert the char
759- if (m_caret <= (int) m_textline.Length())
760+ if (m_caret <= (int) m_textline.length())
761 {
762- m_textline.Insert(m_caret, 1, key);
763+ m_textline.insert(m_caret, 1, key);
764 PlaceCaret(m_caret + 1 );
765 m_selection_start = m_caret;
766 }
767@@ -463,7 +463,7 @@
768 // If we are in overwrite mode and there is already
769 // a char at the caret's position, simply replace it.
770 // Otherwise, we insert the char as normal.
771- if (!m_insert_mode && (m_caret < (int) m_textline.Length()))
772+ if (!m_insert_mode && (m_caret < (int) m_textline.length()))
773 {
774 m_textline[m_caret] = key;
775 PlaceCaret(m_caret + 1 );
776@@ -472,9 +472,9 @@
777 else
778 {
779 // Insert the char
780- if (m_caret <= (int) m_textline.Length())
781+ if (m_caret <= (int) m_textline.length())
782 {
783- m_textline.Insert(m_caret, 1, key);
784+ m_textline.insert(m_caret, 1, key);
785 PlaceCaret(m_caret + 1 );
786 m_selection_start = m_caret;
787 }
788@@ -497,7 +497,7 @@
789 // If we are in overwrite mode and there is already
790 // a char at the caret's position, simply replace it.
791 // Otherwise, we insert the char as normal.
792- if (!m_insert_mode && (m_caret < (int) m_textline.Length()))
793+ if (!m_insert_mode && (m_caret < (int) m_textline.length()))
794 {
795 m_textline[m_caret] = key;
796 PlaceCaret(m_caret + 1 );
797@@ -506,9 +506,9 @@
798 else
799 {
800 // Insert the char
801- if (m_caret <= (int) m_textline.Length())
802+ if (m_caret <= (int) m_textline.length())
803 {
804- m_textline.Insert(m_caret, 1, key);
805+ m_textline.insert(m_caret, 1, key);
806 PlaceCaret(m_caret + 1 );
807 m_selection_start = m_caret;
808 }
809@@ -524,9 +524,9 @@
810 // CTRL+C
811 if ((virtual_code == NUX_VK_C) && (state & NUX_STATE_CTRL))
812 {
813- NString s = GetSelectedText();
814+ std::string s = GetSelectedText();
815 #if defined(NUX_OS_WINDOWS)
816- inlCopyTextToClipboard(s.GetTCharPtr());
817+ inlCopyTextToClipboard(s.c_str());
818 #endif
819 }
820
821@@ -534,15 +534,15 @@
822 if ((virtual_code == NUX_VK_V) && (state & NUX_STATE_CTRL))
823 {
824 #if defined(NUX_OS_WINDOWS)
825- NString s = inlReadTextToClipboard();
826+ std::string s = inlReadTextToClipboard();
827 #elif defined(NUX_OS_LINUX)
828- NString s = "Paste not implemented yet";
829+ std::string s = "Paste not implemented yet";
830 #endif
831 unsigned int start = GetTextSelectionStart();
832 unsigned int end = GetTextSelectionEnd();
833- m_textline.Replace(start, end - start, s.m_string);
834+ m_textline.replace(start, end - start, s);
835
836- m_caret = start + (unsigned int) s.Length();
837+ m_caret = start + (unsigned int) s.length();
838 UnselectAllText();
839 }
840
841@@ -568,7 +568,7 @@
842 // Deleting one character
843 if ( m_caret > 0 )
844 {
845- m_textline.Erase(m_caret - 1, 1);
846+ m_textline.erase(m_caret - 1, 1);
847 PlaceCaret(m_caret - 1 );
848
849 m_selection_start = m_caret;
850@@ -585,9 +585,9 @@
851 else
852 {
853 // Deleting one character
854- if (m_caret < (int) m_textline.Length())
855+ if (m_caret < (int) m_textline.length())
856 {
857- m_textline.Erase(m_caret, 1);
858+ m_textline.erase(m_caret, 1);
859 }
860 }
861 }
862@@ -637,7 +637,7 @@
863 m_caret = NextWordPosition( m_caret);
864 PlaceCaret(m_caret );
865 }
866- else if (m_caret < (int) m_textline.Length())
867+ else if (m_caret < (int) m_textline.length())
868 PlaceCaret(m_caret + 1 );
869
870 if ((state & NUX_STATE_SHIFT) == 0)
871@@ -666,14 +666,14 @@
872 {
873 if ((state & NUX_STATE_SHIFT) == 0)
874 {
875- PlaceCaret((unsigned int) m_textline.Length());
876+ PlaceCaret((unsigned int) m_textline.length());
877 // Shift is not down. Update selection
878 // start along with the caret.
879 m_selection_start = m_caret;
880 }
881 else
882 {
883- PlaceCaret((unsigned int) m_textline.Length());
884+ PlaceCaret((unsigned int) m_textline.length());
885 }
886 }
887 else if (virtual_code == NUX_VK_ESCAPE)
888@@ -695,19 +695,19 @@
889 }
890 else if (virtual_code == NUX_VK_END)
891 {
892- unsigned int str_width = GetFont()->GetStringWidth(m_textline.GetTCharPtr());
893+ unsigned int str_width = GetFont()->GetStringWidth(m_textline.c_str());
894
895 if (str_width + s_cursor_width > (unsigned int) m_clip_region.GetWidth())
896 m_text_positionx = m_clip_region.GetWidth() - (str_width + s_cursor_width);
897 else
898 m_text_positionx = 0;
899 }
900- else if (m_textline.Length() != 0)
901+ else if (m_textline.length() != 0)
902 {
903 AdjustCursorAndTextPosition();
904 m_need_redraw = true;
905 }
906- else if (m_textline.Length() == 0)
907+ else if (m_textline.length() == 0)
908 {
909 ClearText();
910 m_need_redraw = true;
911@@ -719,11 +719,11 @@
912
913 void BaseKeyboardHandler::AdjustCursorAndTextPosition()
914 {
915- int str_width = GetFont()->GetStringWidth(m_textline.GetTCharPtr());
916- NString temp0;
917+ int str_width = GetFont()->GetStringWidth(m_textline.c_str());
918+ std::string temp0;
919
920 if (m_caret > 0)
921- temp0 = m_textline.GetSubString(0, m_caret - 1).GetTStringRef();
922+ temp0 = m_textline.substr(0, m_caret - 1);
923 else
924 temp0 = "";
925
926@@ -736,8 +736,8 @@
927 // temp1 = "abcdefgh"
928 // temp2 = "abcdefghi"
929
930- NString temp1 = m_textline.GetSubString(0, m_caret).GetTStringRef();
931- NString temp2 = m_textline.GetSubString(0, m_caret + 1).GetTStringRef();
932+ std::string temp1 = m_textline.substr(0, m_caret);
933+ std::string temp2 = m_textline.substr(0, m_caret + 1);
934 int str_width0 = GetFont()->GetStringWidth(temp0);
935 int str_width1 = GetFont()->GetStringWidth(temp1);
936 int str_width2 = GetFont()->GetStringWidth(temp2);
937@@ -746,7 +746,7 @@
938 if ((m_text_positionx + str_width1 + s_cursor_width) > m_clip_region.GetWidth())
939 {
940 // Hitting the end of the text box
941- if (m_caret == (int) m_textline.Length())
942+ if (m_caret == (int) m_textline.length())
943 {
944 m_text_positionx = - (str_width + (int) s_cursor_width - m_clip_region.GetWidth());
945 }
946@@ -814,7 +814,7 @@
947 }
948 void BaseKeyboardHandler::MoveCursorAtEnd()
949 {
950- unsigned int StrLength = ( unsigned int) m_textline.Length();
951+ unsigned int StrLength = ( unsigned int) m_textline.length();
952 m_previous_cursor_position = m_caret;
953 m_caret = StrLength;
954 }
955@@ -846,16 +846,11 @@
956 m_text_positionx = 0;
957 }
958
959- void BaseKeyboardHandler::SetText(const tstring &s)
960+ void BaseKeyboardHandler::SetText(const std::string &s)
961 {
962 SetText(s.c_str());
963 }
964
965- void BaseKeyboardHandler::SetText(const NString &s)
966- {
967- SetText(s.GetTCharPtr());
968- }
969-
970 void BaseKeyboardHandler::SetClipRegion(const Geometry &g)
971 {
972 m_clip_region = g;
973@@ -880,7 +875,7 @@
974 void BaseKeyboardHandler::SelectAllText()
975 {
976 m_selection_start = 0;
977- m_caret = (unsigned int) m_textline.Length();
978+ m_caret = (unsigned int) m_textline.length();
979 AdjustCursorAndTextPosition();
980 }
981
982@@ -889,15 +884,15 @@
983 m_selection_start = m_caret;
984 }
985
986- NString BaseKeyboardHandler::GetSelectedText() const
987+ std::string BaseKeyboardHandler::GetSelectedText() const
988 {
989 if (m_selection_start == m_caret)
990 {
991- return NString("");
992+ return std::string("");
993 }
994 else
995 {
996- NString s = m_textline.GetSubString(GetTextSelectionStart(), GetTextSelectionEnd() - GetTextSelectionStart()).GetTStringRef();
997+ std::string s = m_textline.substr(GetTextSelectionStart(), GetTextSelectionEnd() - GetTextSelectionStart());
998 return s;
999 }
1000 }
1001
1002=== modified file 'Nux/KeyboardHandler.h'
1003--- Nux/KeyboardHandler.h 2011-10-21 22:06:35 +0000
1004+++ Nux/KeyboardHandler.h 2012-09-26 05:32:20 +0000
1005@@ -61,13 +61,13 @@
1006 char character /*character*/,
1007 const Geometry &g);
1008
1009- NString GetTextLine() const
1010+ std::string GetTextLine() const
1011 {
1012 return m_textline;
1013 }
1014 unsigned int GetLength() const
1015 {
1016- return (unsigned int) m_textline.Length();
1017+ return (unsigned int) m_textline.length();
1018 }
1019
1020 unsigned int GetCursorPosition() const
1021@@ -88,8 +88,7 @@
1022 }
1023
1024 void SetText(const char *str);
1025- void SetText(const tstring &s);
1026- void SetText(const NString &s);
1027+ void SetText(const std::string &s);
1028
1029 void ClearText();
1030 void PlaceCaret(unsigned int cp);
1031@@ -104,13 +103,13 @@
1032 void GetTextSelection(int *start, int *end) const;
1033 int GetTextSelectionStart() const;
1034 int GetTextSelectionEnd() const;
1035- NString GetSelectedText() const;
1036+ std::string GetSelectedText() const;
1037 void SelectAllText();
1038 void UnselectAllText();
1039 bool IsTextSelected();
1040
1041- void SetPrefix(NString); // 0x865, 25 rad, 25 degree...
1042- void SetPostfix(NString);
1043+ void SetPrefix(std::string); // 0x865, 25 rad, 25 degree...
1044+ void SetPostfix(std::string);
1045
1046 void EnterFocus();
1047
1048@@ -128,7 +127,7 @@
1049
1050 protected:
1051 ObjectPtr<FontTexture> m_Font;
1052- NString m_textline;
1053+ std::string m_textline;
1054 int m_previous_cursor_position;
1055 bool m_need_redraw;
1056 int m_text_positionx;
1057
1058=== modified file 'Nux/Layout.h'
1059--- Nux/Layout.h 2012-09-04 18:56:19 +0000
1060+++ Nux/Layout.h 2012-09-26 05:32:20 +0000
1061@@ -294,7 +294,7 @@
1062
1063 std::list<Area *> _layout_element_list;
1064
1065- NString m_name;
1066+ std::string m_name;
1067
1068 LayoutContentDistribution m_ContentStacking;
1069 };
1070
1071=== modified file 'Nux/MenuPage.cpp'
1072--- Nux/MenuPage.cpp 2011-12-06 16:29:06 +0000
1073+++ Nux/MenuPage.cpp 2012-09-26 05:32:20 +0000
1074@@ -277,7 +277,7 @@
1075 //
1076 const char *MenuPage::GetName() const
1077 {
1078- return m_Name.GetTCharPtr();
1079+ return m_Name.c_str();
1080 }
1081
1082 bool MenuPage::CanClose() const
1083
1084=== modified file 'Nux/MenuPage.h'
1085--- Nux/MenuPage.h 2011-10-17 21:23:50 +0000
1086+++ Nux/MenuPage.h 2012-09-26 05:32:20 +0000
1087@@ -275,7 +275,7 @@
1088 VLayout* _vlayout;
1089 bool m_NextMouseUpMeanStop;
1090 MenuItem *m_SubMenuAction;
1091- NString m_Name;
1092+ std::string m_Name;
1093
1094 bool m_Action_Triggered;
1095 MenuPage *m_Parent;
1096
1097=== modified file 'Nux/NumericValuator.cpp'
1098--- Nux/NumericValuator.cpp 2012-07-04 16:36:46 +0000
1099+++ Nux/NumericValuator.cpp 2012-09-26 05:32:20 +0000
1100@@ -26,6 +26,8 @@
1101 #include "DoubleValidator.h"
1102 #include "NumericValuator.h"
1103
1104+#include <string>
1105+
1106 namespace nux
1107 {
1108
1109@@ -47,7 +49,7 @@
1110 void NumericValuator::InitializeWidgets()
1111 {
1112 m_EditLine->SetValidator(&m_DoubleValidator);
1113- m_EditLine->SetText(NString::Printf("%d", m_DoubleValidator.GetMinimum()));
1114+ m_EditLine->SetText(std::to_string(m_DoubleValidator.GetMinimum()));
1115
1116 m_EditLine->SetMinimumSize(2 * DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT);
1117 m_EditLine->SetGeometry(Geometry(0, 0, 2 * DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT));
1118@@ -104,7 +106,7 @@
1119 if (m_fValue > m_DoubleValidator.GetMaximum())
1120 m_fValue = m_DoubleValidator.GetMaximum();
1121
1122- m_EditLine->SetText(NString::Printf("%f", m_fValue));
1123+ m_EditLine->SetText(std::to_string(m_fValue));
1124 }
1125
1126 float NumericValuator::GetValue() const
1127@@ -152,20 +154,20 @@
1128 void NumericValuator::ImplementValidateEntry()
1129 {
1130 double ret = 0;
1131- ret = CharToDouble(m_EditLine->GetCleanText().GetTCharPtr());
1132+ ret = CharToDouble(m_EditLine->GetCleanText().c_str());
1133 {
1134 m_fValue = ret;
1135
1136 if (m_fValue < m_DoubleValidator.GetMinimum())
1137 {
1138 m_fValue = m_DoubleValidator.GetMinimum();
1139- m_EditLine->SetText(NString::Printf("%f", m_fValue));
1140+ m_EditLine->SetText(std::to_string(m_fValue));
1141 }
1142
1143 if (m_fValue > m_DoubleValidator.GetMaximum())
1144 {
1145 m_fValue = m_DoubleValidator.GetMaximum();
1146- m_EditLine->SetText(NString::Printf("%f", m_fValue));
1147+ m_EditLine->SetText(std::to_string(m_fValue));
1148 }
1149 }
1150 // else
1151
1152=== modified file 'Nux/PangoText.cpp'
1153--- Nux/PangoText.cpp 2012-05-25 20:36:09 +0000
1154+++ Nux/PangoText.cpp 2012-09-26 05:32:20 +0000
1155@@ -131,7 +131,7 @@
1156 // intentionally left empty
1157 }
1158
1159- void PangoText::SetText(NString text)
1160+ void PangoText::SetText(std::string text)
1161 {
1162 if (_text != text)
1163 {
1164
1165=== modified file 'Nux/RGBValuator.cpp'
1166--- Nux/RGBValuator.cpp 2012-09-17 09:55:43 +0000
1167+++ Nux/RGBValuator.cpp 2012-09-26 05:32:20 +0000
1168@@ -31,6 +31,9 @@
1169 #include "DoubleValidator.h"
1170 #include "RGBValuator.h"
1171
1172+#include <sstream>
1173+#include <iomanip>
1174+
1175 namespace nux
1176 {
1177 NUX_IMPLEMENT_OBJECT_TYPE(RGBValuator);
1178@@ -648,6 +651,27 @@
1179 SetRGB(color.red, color.green, color.blue);
1180 }
1181
1182+ std::string as_hex(float f)
1183+ {
1184+ std::ostringstream s;
1185+ s << std::hex << (int)f;
1186+ return s.str();
1187+ }
1188+
1189+ std::string as_dec(float f)
1190+ {
1191+ std::ostringstream s;
1192+ s << (int)f;
1193+ return s.str();
1194+ }
1195+
1196+ std::string as_float(float f)
1197+ {
1198+ std::ostringstream s;
1199+ s << std::setprecision(3) << f;
1200+ return s.str();
1201+ }
1202+
1203 void RGBValuator::SetRGB(float r, float g, float b)
1204 {
1205 rgb_.red = Clamp(r, 0.0f, 1.0f);
1206@@ -660,21 +684,21 @@
1207
1208 if (m_color_format == color::HEX)
1209 {
1210- red_caption_->SetText(NString::Printf("%x", (int) (rgb_.red * 255)));
1211- green_caption_->SetText(NString::Printf("%x", (int) (rgb_.green * 255)));
1212- blue_caption_->SetText(NString::Printf("%x", (int) (rgb_.blue * 255)));
1213+ red_caption_->SetText(as_hex(rgb_.red * 255));
1214+ green_caption_->SetText(as_hex(rgb_.green * 255));
1215+ blue_caption_->SetText(as_hex(rgb_.blue * 255));
1216 }
1217 else if (m_color_format == color::INT)
1218 {
1219- red_caption_->SetText(NString::Printf("%d", (int) (rgb_.red * 255)));
1220- green_caption_->SetText(NString::Printf("%d", (int) (rgb_.green * 255)));
1221- blue_caption_->SetText(NString::Printf("%d", (int) (rgb_.blue * 255)));
1222+ red_caption_->SetText(as_dec(rgb_.red * 255));
1223+ green_caption_->SetText(as_dec(rgb_.green * 255));
1224+ blue_caption_->SetText(as_dec(rgb_.blue * 255));
1225 }
1226 else
1227 {
1228- red_caption_->SetText(NString::Printf("%.3f", rgb_.red));
1229- green_caption_->SetText(NString::Printf("%.3f", rgb_.green));
1230- blue_caption_->SetText(NString::Printf("%.3f", rgb_.blue));
1231+ red_caption_->SetText(as_float(rgb_.red));
1232+ green_caption_->SetText(as_float(rgb_.green));
1233+ blue_caption_->SetText(as_float(rgb_.blue));
1234 }
1235
1236 // Restore text selection if necessary.
1237@@ -701,21 +725,21 @@
1238
1239 if (m_color_format == color::HEX)
1240 {
1241- red_caption_->SetText(NString::Printf("%x", (int) (hsv_.hue * 255)));
1242- green_caption_->SetText(NString::Printf("%x", (int) (hsv_.saturation * 255)));
1243- blue_caption_->SetText(NString::Printf("%x", (int) (hsv_.value * 255)));
1244+ red_caption_->SetText(as_hex(hsv_.hue * 255));
1245+ green_caption_->SetText(as_hex(hsv_.saturation * 255));
1246+ blue_caption_->SetText(as_hex(hsv_.value * 255));
1247 }
1248 else if (m_color_format == color::INT)
1249 {
1250- red_caption_->SetText(NString::Printf("%d", (int) (hsv_.hue * 255)));
1251- green_caption_->SetText(NString::Printf("%d", (int) (hsv_.saturation * 255)));
1252- blue_caption_->SetText(NString::Printf("%d", (int) (hsv_.value * 255)));
1253+ red_caption_->SetText(as_dec(hsv_.hue * 255));
1254+ green_caption_->SetText(as_dec(hsv_.saturation * 255));
1255+ blue_caption_->SetText(as_dec(hsv_.value * 255));
1256 }
1257 else
1258 {
1259- red_caption_->SetText(NString::Printf("%.3f", hsv_.hue));
1260- green_caption_->SetText(NString::Printf("%.3f", hsv_.saturation));
1261- blue_caption_->SetText(NString::Printf("%.3f", hsv_.value));
1262+ red_caption_->SetText(as_float(hsv_.hue));
1263+ green_caption_->SetText(as_float(hsv_.saturation));
1264+ blue_caption_->SetText(as_float(hsv_.value));
1265 }
1266
1267 if (hsv_.hue >= 1.0f)
1268@@ -746,21 +770,21 @@
1269
1270 if (m_color_format == color::HEX)
1271 {
1272- red_caption_->SetText(NString::Printf("%x", (int) (hls_.hue * 255)));
1273- green_caption_->SetText(NString::Printf("%x", (int) (hls_.lightness * 255)));
1274- blue_caption_->SetText(NString::Printf("%x", (int) (hls_.saturation * 255)));
1275+ red_caption_->SetText(as_hex(hls_.hue * 255));
1276+ green_caption_->SetText(as_hex(hls_.lightness * 255));
1277+ blue_caption_->SetText(as_hex(hls_.saturation * 255));
1278 }
1279 else if (m_color_format == color::INT)
1280 {
1281- red_caption_->SetText(NString::Printf("%d", (int) (hls_.hue * 255)));
1282- green_caption_->SetText(NString::Printf("%d", (int) (hls_.lightness * 255)));
1283- blue_caption_->SetText(NString::Printf("%d", (int) (hls_.saturation * 255)));
1284+ red_caption_->SetText(as_dec(hls_.hue * 255));
1285+ green_caption_->SetText(as_dec(hls_.lightness * 255));
1286+ blue_caption_->SetText(as_dec(hls_.saturation * 255));
1287 }
1288 else
1289 {
1290- red_caption_->SetText(NString::Printf("%.3f", hls_.hue));
1291- green_caption_->SetText(NString::Printf("%.3f", hls_.lightness));
1292- blue_caption_->SetText(NString::Printf("%.3f", hls_.saturation));
1293+ red_caption_->SetText(as_float(hls_.hue));
1294+ green_caption_->SetText(as_float(hls_.lightness));
1295+ blue_caption_->SetText(as_float(hls_.saturation));
1296 }
1297
1298 if (hls_.hue >= 1.0f)
1299@@ -785,15 +809,15 @@
1300
1301 if (m_color_format == color::HEX)
1302 {
1303- alpha_caption_->SetText(NString::Printf("%x", (int) (alpha_ * 255)));
1304+ alpha_caption_->SetText(as_hex(alpha_ * 255));
1305 }
1306 else if (m_color_format == color::INT)
1307 {
1308- alpha_caption_->SetText(NString::Printf("%d", (int) (alpha_ * 255)));
1309+ alpha_caption_->SetText(as_dec(alpha_ * 255));
1310 }
1311 else
1312 {
1313- alpha_caption_->SetText(NString::Printf("%.3f", alpha_));
1314+ alpha_caption_->SetText(as_float(alpha_));
1315 }
1316
1317 sigColorChanged.emit(rgb_.red, rgb_.green, rgb_.blue, alpha_);
1318@@ -1211,21 +1235,21 @@
1319
1320 }
1321
1322- void RGBValuator::OnComponentInput(EditTextBox *textbox, const NString &s, int componentIndex)
1323+ void RGBValuator::OnComponentInput(EditTextBox *textbox, const std::string &s, int componentIndex)
1324 {
1325 float f = 0;
1326
1327- if ((m_color_format == color::HEX) && (m_HexRegExp.Validate(s.GetTCharPtr()) == Validator::Acceptable))
1328+ if ((m_color_format == color::HEX) && (m_HexRegExp.Validate(s.c_str()) == Validator::Acceptable))
1329 {
1330- f = (float) m_HexRegExp.ToInteger(s.GetTCharPtr()) / 255.0f;
1331+ f = (float) m_HexRegExp.ToInteger(s.c_str()) / 255.0f;
1332 }
1333- else if ((m_color_format == color::INT) && (m_IntRegExp.Validate(s.GetTCharPtr()) == Validator::Acceptable))
1334+ else if ((m_color_format == color::INT) && (m_IntRegExp.Validate(s.c_str()) == Validator::Acceptable))
1335 {
1336- f = (float) m_IntRegExp.ToInteger(s.GetTCharPtr()) / 255.0f;
1337+ f = (float) m_IntRegExp.ToInteger(s.c_str()) / 255.0f;
1338 }
1339 else
1340 {
1341- f = (float) m_DoubleRegExp.ToDouble(s.GetTCharPtr());
1342+ f = (float) m_DoubleRegExp.ToDouble(s.c_str());
1343 }
1344
1345 f = Clamp(f, 0.0f, 1.0f);
1346@@ -1302,7 +1326,7 @@
1347 if (componentIndex == 3)
1348 {
1349 float f = 0;
1350- f = CharToDouble(s.GetTCharPtr());
1351+ f = CharToDouble(s.c_str());
1352 f = Clamp(f, 0.0f, 1.0f);
1353 //if(m_color_model == color::RGB)
1354 {
1355
1356=== modified file 'Nux/RGBValuator.h'
1357--- Nux/RGBValuator.h 2012-08-17 12:41:21 +0000
1358+++ Nux/RGBValuator.h 2012-09-26 05:32:20 +0000
1359@@ -87,7 +87,7 @@
1360 void OnReceiveMouseUp_Green (int x, int y, unsigned long button_flags, unsigned long key_flags);
1361 void OnReceiveMouseUp_Blue (int x, int y, unsigned long button_flags, unsigned long key_flags);
1362
1363- void OnComponentInput (EditTextBox *textbox, const NString &s, int componentIndex);
1364+ void OnComponentInput (EditTextBox *textbox, const std::string &s, int componentIndex);
1365 void OnChannelKeyboardFocus();
1366 void OnChannelLostKeyboardFocus();
1367 void OnChannelValidateKeyboardEntry();
1368
1369=== modified file 'Nux/RangeValue.cpp'
1370--- Nux/RangeValue.cpp 2012-08-17 12:41:21 +0000
1371+++ Nux/RangeValue.cpp 2012-09-26 05:32:20 +0000
1372@@ -25,6 +25,9 @@
1373 #include "HLayout.h"
1374 #include "RangeValue.h"
1375
1376+#include <sstream>
1377+#include <iomanip>
1378+
1379 namespace nux
1380 {
1381 NUX_IMPLEMENT_OBJECT_TYPE(RangeValue);
1382@@ -172,7 +175,7 @@
1383 else
1384 m_Value = value;
1385
1386- m_ValueString->SetText(NString::Printf("%.3f", m_Value));
1387+ m_ValueString->SetText(std::to_string(m_Value));
1388 QueueDraw();
1389 }
1390
1391@@ -193,7 +196,7 @@
1392 else
1393 m_Value = m_min + (m_max - m_min) * (float) x / (float) m_Percentage->GetBaseWidth();
1394
1395- m_ValueString->SetText(NString::Printf("%.3f", m_Value));
1396+ m_ValueString->SetText(std::to_string(m_Value));
1397 sigValueChanged.emit(this);
1398 sigFloatChanged.emit(m_Value);
1399 sigMouseDown.emit(m_Value);
1400@@ -211,7 +214,9 @@
1401 else
1402 m_Value = m_min + (m_max - m_min) * (float) x / (float) m_Percentage->GetBaseWidth();
1403
1404- m_ValueString->SetText(NString::Printf("%.3f", m_Value));
1405+ std::stringstream s;
1406+ s << std::setprecision(3) << m_Value;
1407+ m_ValueString->SetText(s.str());
1408 sigValueChanged.emit(this);
1409 sigFloatChanged.emit(m_Value);
1410 sigMouseUp.emit(m_Value);
1411@@ -228,7 +233,9 @@
1412 else
1413 m_Value = m_min + (m_max - m_min) * (float) x / (float) m_Percentage->GetBaseWidth();
1414
1415- m_ValueString->SetText(NString::Printf("%.3f", m_Value));
1416+ std::stringstream s;
1417+ s << std::setprecision(3) << m_Value;
1418+ m_ValueString->SetText(s.str());
1419 sigValueChanged.emit(this);
1420 sigFloatChanged.emit(m_Value);
1421 sigMouseDrag.emit(m_Value);
1422@@ -246,10 +253,10 @@
1423
1424 }
1425
1426- void RangeValue::OnValidateKeyboardEntry(EditTextBox *textbox, const NString &text)
1427+ void RangeValue::OnValidateKeyboardEntry(EditTextBox *textbox, const std::string &text)
1428 {
1429 float f;
1430- f = CharToDouble(text.GetTCharPtr());
1431+ f = CharToDouble(text.c_str());
1432 SetValue(f);
1433 sigValueChanged.emit(this);
1434 sigFloatChanged.emit(m_Value);
1435
1436=== modified file 'Nux/RangeValue.h'
1437--- Nux/RangeValue.h 2012-08-17 12:41:21 +0000
1438+++ Nux/RangeValue.h 2012-09-26 05:32:20 +0000
1439@@ -89,7 +89,7 @@
1440 void OnReceiveMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
1441 void OnKeyboardFocus();
1442 void OnLostKeyboardFocus();
1443- void OnValidateKeyboardEntry(EditTextBox *textbox, const NString &text);
1444+ void OnValidateKeyboardEntry(EditTextBox *textbox, const std::string &text);
1445
1446 bool IsCtrlKeyPressed() const
1447 {
1448
1449=== modified file 'Nux/RangeValueInteger.cpp'
1450--- Nux/RangeValueInteger.cpp 2012-08-17 12:41:21 +0000
1451+++ Nux/RangeValueInteger.cpp 2012-09-26 05:32:20 +0000
1452@@ -169,7 +169,7 @@
1453 m_Value = value;
1454
1455 m_MarkerPosition = m_Value;
1456- m_ValueString->SetText(NString::Printf("%d", m_Value));
1457+ m_ValueString->SetText(std::to_string(m_Value));
1458 QueueDraw();
1459 }
1460
1461@@ -202,7 +202,7 @@
1462 m_Value++;
1463 }
1464
1465- m_ValueString->SetText(NString::Printf("%d", m_Value));
1466+ m_ValueString->SetText(std::to_string(m_Value));
1467 sigValueChanged.emit(this);
1468 sigMouseDown.emit(m_Value);
1469 sigValueChanged2.emit(m_Value);
1470@@ -225,7 +225,7 @@
1471 }
1472
1473 m_MarkerPosition = m_Value;
1474- m_ValueString->SetText(NString::Printf("%d", m_Value));
1475+ m_ValueString->SetText(std::to_string(m_Value));
1476 sigValueChanged.emit(this);
1477 sigMouseUp.emit(m_Value);
1478 sigValueChanged2.emit(m_Value);
1479@@ -254,7 +254,7 @@
1480 m_Value++;
1481 }
1482
1483- m_ValueString->SetText(NString::Printf("%d", m_Value));
1484+ m_ValueString->SetText(std::to_string(m_Value));
1485 sigValueChanged.emit(this);
1486 sigMouseDrag.emit(m_Value);
1487 sigValueChanged2.emit(m_Value);
1488@@ -272,10 +272,10 @@
1489
1490 }
1491
1492- void RangeValueInteger::OnValidateKeyboardEntry(EditTextBox *textbox, const NString &text)
1493+ void RangeValueInteger::OnValidateKeyboardEntry(EditTextBox *textbox, const std::string &text)
1494 {
1495 int i;
1496- i = CharToInteger(text.GetTCharPtr());
1497+ i = CharToInteger(text.c_str());
1498 SetValue(i);
1499 sigValueChanged.emit(this);
1500 sigSetTypedValue.emit(i);
1501
1502=== modified file 'Nux/RangeValueInteger.h'
1503--- Nux/RangeValueInteger.h 2012-08-17 12:41:21 +0000
1504+++ Nux/RangeValueInteger.h 2012-09-26 05:32:20 +0000
1505@@ -94,7 +94,7 @@
1506 void OnReceiveMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
1507 void OnKeyboardFocus();
1508 void OnLostKeyboardFocus();
1509- void OnValidateKeyboardEntry(EditTextBox *textbox, const NString &text);
1510+ void OnValidateKeyboardEntry(EditTextBox *textbox, const std::string &text);
1511
1512 bool IsCtrlKeyPressed() const
1513 {
1514
1515=== modified file 'Nux/SpinBox.cpp'
1516--- Nux/SpinBox.cpp 2012-07-04 16:36:46 +0000
1517+++ Nux/SpinBox.cpp 2012-09-26 05:32:20 +0000
1518@@ -43,7 +43,7 @@
1519 m_EditLine->SetValidator(&m_IntValidator);
1520 m_EditLine->SetSuffix("");
1521 m_EditLine->SetPrefix("");
1522- m_EditLine->SetText(NString::Printf("%d", m_IntValidator.GetMinimum()));
1523+ m_EditLine->SetText(std::to_string(m_IntValidator.GetMinimum()));
1524
1525 m_EditLine->SetMinimumSize(1.5 * DEFAULT_WIDGET_WIDTH, DEFAULT_WIDGET_HEIGHT);
1526 m_EditLine->SetGeometry(Geometry(0, 0, DEFAULT_WIDGET_WIDTH, DEFAULT_WIDGET_HEIGHT));
1527@@ -134,7 +134,7 @@
1528 void SpinBox::SetValue(int value)
1529 {
1530 m_iValue = m_IntValidator.GetClampedValue(value);
1531- m_EditLine->SetText(NString::Printf("%d", m_iValue));
1532+ m_EditLine->SetText(std::to_string(m_iValue));
1533 sigValueChanged.emit(this);
1534 sigValue.emit(m_iValue);
1535 QueueDraw();
1536@@ -221,10 +221,10 @@
1537 void SpinBox::ImplementValidateEntry()
1538 {
1539 double ret = 0;
1540- ret = CharToDouble(m_EditLine->GetCleanText().GetTCharPtr());
1541+ ret = CharToDouble(m_EditLine->GetCleanText().c_str());
1542 {
1543 m_iValue = m_IntValidator.GetClampedValue(ret);
1544- m_EditLine->SetText(NString::Printf("%d", m_iValue));
1545+ m_EditLine->SetText(std::to_string(m_iValue));
1546 sigValueChanged.emit(this);
1547 sigValue.emit(m_iValue);
1548 //
1549
1550=== modified file 'Nux/SpinBoxDouble.cpp'
1551--- Nux/SpinBoxDouble.cpp 2012-07-04 16:36:46 +0000
1552+++ Nux/SpinBoxDouble.cpp 2012-09-26 05:32:20 +0000
1553@@ -53,7 +53,7 @@
1554 m_EditLine->SetValidator(&m_DoubleValidator);
1555 m_EditLine->SetSuffix("");
1556 m_EditLine->SetPrefix("");
1557- m_EditLine->SetText(NString::Printf("%.3f", m_DoubleValidator.GetMinimum()));
1558+ m_EditLine->SetText(std::to_string(m_DoubleValidator.GetMinimum()));
1559
1560 m_EditLine->SetMinimumSize(1.5 * DEFAULT_WIDGET_WIDTH, DEFAULT_WIDGET_HEIGHT);
1561 m_EditLine->SetGeometry(Geometry(0, 0, DEFAULT_WIDGET_WIDTH, DEFAULT_WIDGET_HEIGHT));
1562@@ -141,7 +141,7 @@
1563 // m_Value = m_DoubleValidator.GetMinimum();
1564 // if (m_Value > m_DoubleValidator.GetMaximum())
1565 // m_Value = m_DoubleValidator.GetMaximum();
1566- m_EditLine->SetText(NString::Printf("%.3f", m_Value));
1567+ m_EditLine->SetText(std::to_string(m_Value));
1568 sigValueChanged.emit(this);
1569 sigValue.emit(m_Value);
1570 QueueDraw();
1571@@ -228,10 +228,10 @@
1572 void SpinBoxDouble::ImplementValidateEntry()
1573 {
1574 double ret = 0;
1575- ret = CharToDouble(m_EditLine->GetCleanText().GetTCharPtr());
1576+ ret = CharToDouble(m_EditLine->GetCleanText().c_str());
1577 {
1578 m_Value = m_DoubleValidator.GetClampedValue(ret);
1579- m_EditLine->SetText(NString::Printf("%.3f", m_Value));
1580+ m_EditLine->SetText(std::to_string(m_Value));
1581 sigValueChanged.emit(this);
1582 sigValue.emit(m_Value);
1583 //
1584
1585=== modified file 'Nux/StaticTextBox.cpp'
1586--- Nux/StaticTextBox.cpp 2012-08-27 09:09:21 +0000
1587+++ Nux/StaticTextBox.cpp 2012-09-26 05:32:20 +0000
1588@@ -67,13 +67,13 @@
1589 if (m_bDrawBackground)
1590 {
1591 GetPainter().PushDrawLayer(graphics_engine, base, m_Background);
1592- GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), GetGeometry(), m_Text.m_string, m_TextColor, m_WriteAlpha, m_TextAlignment);
1593+ GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), GetGeometry(), m_Text, m_TextColor, m_WriteAlpha, m_TextAlignment);
1594 GetPainter().PopBackground();
1595 }
1596 else
1597 {
1598 //GetPainter().PaintBackground(graphics_engine, base);
1599- GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), GetGeometry(), m_Text.m_string, m_TextColor, m_WriteAlpha, m_TextAlignment);
1600+ GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), GetGeometry(), m_Text, m_TextColor, m_WriteAlpha, m_TextAlignment);
1601 }
1602
1603 graphics_engine.PopClippingRectangle();
1604@@ -90,25 +90,13 @@
1605
1606 }
1607
1608- void StaticTextBox::SetText(const char &Caption)
1609- {
1610- NString s(Caption);
1611- SetText(s);
1612- }
1613-
1614 void StaticTextBox::SetText(const char *Caption)
1615 {
1616- NString s(Caption);
1617- SetText(s);
1618- }
1619-
1620- void StaticTextBox::SetText(const tstring &Caption)
1621- {
1622- NString s(Caption);
1623- SetText(s);
1624- }
1625-
1626- void StaticTextBox::SetText(const NString &Caption)
1627+ std::string s(Caption);
1628+ SetText(s);
1629+ }
1630+
1631+ void StaticTextBox::SetText(const std::string &Caption)
1632 {
1633 m_Text = Caption;
1634
1635@@ -133,10 +121,10 @@
1636
1637 void StaticTextBox::AdjustMinWidthToMatchText()
1638 {
1639- if (m_Text.Size() == 0)
1640+ if (m_Text.size() == 0)
1641 return;
1642
1643- SetMinimumWidth(/*4 + */GetFont()->GetStringWidth(m_Text.GetTStringRef()));
1644+ SetMinimumWidth(/*4 + */GetFont()->GetStringWidth(m_Text));
1645 }
1646
1647 void StaticTextBox::SetFont(ObjectPtr<FontTexture> Font)
1648
1649=== modified file 'Nux/StaticTextBox.h'
1650--- Nux/StaticTextBox.h 2011-10-21 22:06:35 +0000
1651+++ Nux/StaticTextBox.h 2012-09-26 05:32:20 +0000
1652@@ -39,14 +39,12 @@
1653 virtual void PostDraw(GraphicsEngine &graphics_engine, bool force_draw);
1654
1655 // API
1656- void SetText(const char &Caption);
1657 void SetText(const char *Caption);
1658- void SetText(const tstring &Caption);
1659- void SetText(const NString &Caption);
1660+ void SetText(const std::string &Caption);
1661 const char *GetText() const;
1662 unsigned int GetTextSize() const
1663 {
1664- return (unsigned int) m_Text.Length();
1665+ return (unsigned int) m_Text.length();
1666 }
1667
1668 //! Change the widget minimum width whenever the text is set.
1669@@ -100,7 +98,7 @@
1670 virtual bool AcceptKeyNavFocus();
1671 void AdjustMinWidthToMatchText();
1672
1673- NString m_Text;
1674+ std::string m_Text;
1675 Color m_TextColor;
1676 Color m_BackgroundColor;
1677 tstring m_temporary_caption;
1678
1679=== modified file 'Nux/SystemThread.h'
1680--- Nux/SystemThread.h 2011-12-29 18:06:53 +0000
1681+++ Nux/SystemThread.h 2012-09-26 05:32:20 +0000
1682@@ -82,7 +82,7 @@
1683 // Declare operator adress-of as private
1684 SystemThread *operator &();
1685
1686- NString m_ThreadName;
1687+ std::string m_ThreadName;
1688
1689 friend SystemThread *CreateSystemThread(AbstractThread *Parent, ThreadUserInitFunc UserInitFunc, void *InitData);
1690
1691
1692=== modified file 'Nux/TabView.cpp'
1693--- Nux/TabView.cpp 2012-08-17 12:41:21 +0000
1694+++ Nux/TabView.cpp 2012-09-26 05:32:20 +0000
1695@@ -40,7 +40,7 @@
1696 Color TabView::TAB_HEADER_COLOR = Color(0xFF333333);
1697 Color TabView::TAB_HEADER_FOCUS_COLOR = Color(0xFF5D5D5D);
1698
1699- TabView::TabElement::TabElement(NString TabName, Layout *TabLayout)
1700+ TabView::TabElement::TabElement(std::string TabName, Layout *TabLayout)
1701 {
1702 _index = 0;
1703 _tab_name = TabName;
1704@@ -78,7 +78,7 @@
1705 return _tab_area->GetGeometry();
1706 }
1707
1708- const NString &TabView::TabElement::GetName() const
1709+ const std::string &TabView::TabElement::GetName() const
1710 {
1711 return _tab_name;
1712 }
1713@@ -206,7 +206,7 @@
1714 for (unsigned int i = 0; i < vector_size; i++)
1715 {
1716 Geometry tab_geo = _tab_array[i]->_tab_area->GetGeometry();
1717- const char *tab_text = _tab_array[i]->GetName().GetTCharPtr();
1718+ const char *tab_text = _tab_array[i]->GetName().c_str();
1719
1720 if (_tab_array[i]->_index == m_FocusTabIndex)
1721 {
1722
1723=== modified file 'Nux/TabView.h'
1724--- Nux/TabView.h 2012-08-17 12:41:21 +0000
1725+++ Nux/TabView.h 2012-09-26 05:32:20 +0000
1726@@ -63,16 +63,16 @@
1727 class TabElement
1728 {
1729 public:
1730- TabElement(NString TabName, Layout *TabLayout);
1731+ TabElement(std::string TabName, Layout *TabLayout);
1732 ~TabElement();
1733
1734 void SetIndex(int index);
1735 int GetIndex() const;
1736 void SetGeometry(const Geometry &geo);
1737 Geometry const& GetGeometry() const;
1738- const NString &GetName() const;
1739+ const std::string &GetName() const;
1740
1741- NString _tab_name;
1742+ std::string _tab_name;
1743 Layout *_tab_content_layout;
1744 BasicView *_tab_area;
1745 int _index;
1746
1747=== modified file 'Nux/Theme.cpp'
1748--- Nux/Theme.cpp 2012-08-07 20:39:44 +0000
1749+++ Nux/Theme.cpp 2012-09-26 05:32:20 +0000
1750@@ -204,8 +204,8 @@
1751 {
1752 BaseTexture* device_texture;
1753
1754- NString texture_filename = NUX_FIND_RESOURCE_LOCATION_NOFAIL(*value_cursor);
1755- device_texture = theme->Load2DTextureFile(texture_filename.GetTCharPtr());
1756+ std::string texture_filename = NUX_FIND_RESOURCE_LOCATION_NOFAIL(*value_cursor);
1757+ device_texture = theme->Load2DTextureFile(texture_filename.c_str());
1758
1759 pimage->texture = device_texture;
1760 }
1761@@ -228,8 +228,8 @@
1762
1763 void UXTheme::LoadPainterImages()
1764 {
1765- NString file_search = "Painter.xml";
1766- NString painter_filename = NUX_FIND_RESOURCE_LOCATION_NOFAIL(file_search.GetTCharPtr());
1767+ std::string file_search = "Painter.xml";
1768+ std::string painter_filename = NUX_FIND_RESOURCE_LOCATION_NOFAIL(file_search.c_str());
1769
1770 if (painter_filename == "")
1771 {
1772@@ -253,10 +253,10 @@
1773 this,
1774 NULL);
1775
1776- NString str;
1777- LoadFileToString(str, painter_filename.GetTCharPtr());
1778+ std::string str;
1779+ LoadFileToString(str, painter_filename.c_str());
1780
1781- if (g_markup_parse_context_parse(context, str.GetTCharPtr(), str.Length(), NULL) == FALSE)
1782+ if (g_markup_parse_context_parse(context, str.c_str(), str.length(), NULL) == FALSE)
1783 {
1784 nuxCriticalMsg("[GraphicsEngine::LoadPainterImages] Failed to parse data.");
1785 return;
1786@@ -264,7 +264,7 @@
1787
1788 #else
1789
1790- TiXmlDocument doc(painter_filename.GetTCharPtr());
1791+ TiXmlDocument doc(painter_filename.c_str());
1792 doc.LoadFile();
1793
1794 TiXmlHandle docHandle( &doc );
1795@@ -276,9 +276,9 @@
1796 PainterImage *pimage = new PainterImage;
1797 Memset(pimage, 0, sizeof(PainterImage));
1798
1799- NString style = image->Attribute(TCHARToUTF8("style"));
1800+ std::string style = image->Attribute(TCHARToUTF8("style"));
1801
1802- pimage->style = GetStyleImageRef(style.GetTCharPtr());
1803+ pimage->style = GetStyleImageRef(style.c_str());
1804
1805 // If the attributes border_left, border_right, border_top, border_bottom are not present, assume they are equal to 0;
1806 pimage->border_left = pimage->border_right = pimage->border_top = pimage->border_bottom = 0;
1807@@ -311,17 +311,17 @@
1808 {
1809 BaseTexture* device_texture;
1810
1811- NString filename = image->Attribute(TCHARToUTF8("Name"));
1812- NString texture_filename = NUX_FIND_RESOURCE_LOCATION_NOFAIL(filename.GetTCharPtr());
1813- device_texture = Load2DTextureFile(texture_filename.GetTCharPtr());
1814+ std::string filename = image->Attribute(TCHARToUTF8("Name"));
1815+ std::string texture_filename = NUX_FIND_RESOURCE_LOCATION_NOFAIL(filename.c_str());
1816+ device_texture = Load2DTextureFile(texture_filename.c_str());
1817
1818 pimage->texture = device_texture;
1819 }
1820 else
1821 {
1822- NString filename = image->Attribute(TCHARToUTF8("Name"));
1823- NString texture_filename = NUX_FIND_RESOURCE_LOCATION_NOFAIL(filename.GetTCharPtr());
1824- pimage->texture = Load2DTextureFile(texture_filename.GetTCharPtr());
1825+ std::string filename = image->Attribute(TCHARToUTF8("Name"));
1826+ std::string texture_filename = NUX_FIND_RESOURCE_LOCATION_NOFAIL(filename.c_str());
1827+ pimage->texture = Load2DTextureFile(texture_filename.c_str());
1828 }
1829
1830 painter_image_list_.push_back(pimage);
1831
1832=== modified file 'Nux/VLayout.cpp'
1833--- Nux/VLayout.cpp 2012-07-30 21:02:35 +0000
1834+++ Nux/VLayout.cpp 2012-09-26 05:32:20 +0000
1835@@ -49,7 +49,7 @@
1836
1837 }
1838
1839- VLayout::VLayout(NString name, NUX_FILE_LINE_DECL)
1840+ VLayout::VLayout(std::string name, NUX_FILE_LINE_DECL)
1841 : LinearLayout(NUX_FILE_LINE_PARAM)
1842 {
1843 m_name = name;
1844
1845=== modified file 'Nux/VLayout.h'
1846--- Nux/VLayout.h 2011-10-21 22:06:35 +0000
1847+++ Nux/VLayout.h 2012-09-26 05:32:20 +0000
1848@@ -33,7 +33,7 @@
1849 NUX_DECLARE_OBJECT_TYPE(VLayout, LinearLayout);
1850 public:
1851 VLayout(NUX_FILE_LINE_PROTO);
1852- VLayout(NString name, NUX_FILE_LINE_PROTO);
1853+ VLayout(std::string name, NUX_FILE_LINE_PROTO);
1854 ~VLayout();
1855
1856 virtual long ComputeContentSize();
1857
1858=== modified file 'Nux/Validator.cpp'
1859--- Nux/Validator.cpp 2011-10-10 01:52:00 +0000
1860+++ Nux/Validator.cpp 2012-09-26 05:32:20 +0000
1861@@ -38,13 +38,13 @@
1862 bool Validator::InitRegExp()
1863 {
1864 #if defined(NUX_OS_WINDOWS)
1865- regex_ = _regexp_str.GetTCharPtr();
1866+ regex_ = _regexp_str.c_str();
1867 return true;
1868 #else
1869 const char *error;
1870 int erroffset;
1871 _regexp = pcre_compile(
1872- _regexp_str.GetTCharPtr(), /* the pattern */
1873+ _regexp_str.c_str(), /* the pattern */
1874 PCRE_MULTILINE,
1875 &error, /* for error message */
1876 &erroffset, /* for error offset */
1877@@ -52,7 +52,7 @@
1878
1879 if (!_regexp)
1880 {
1881- nuxDebugMsg("[IntegerValidator::IntegerValidator] Invalid regular expression: %s", _regexp_str.GetTCharPtr());
1882+ nuxDebugMsg("[IntegerValidator::IntegerValidator] Invalid regular expression: %s", _regexp_str.c_str());
1883 return false;
1884 }
1885 return true;
1886
1887=== modified file 'Nux/Validator.h'
1888--- Nux/Validator.h 2011-10-17 21:23:50 +0000
1889+++ Nux/Validator.h 2012-09-26 05:32:20 +0000
1890@@ -52,7 +52,7 @@
1891
1892 protected:
1893 bool InitRegExp();
1894- NString _regexp_str;
1895+ std::string _regexp_str;
1896
1897 #if defined(NUX_OS_WINDOWS)
1898 std::regex regex_;
1899
1900=== modified file 'Nux/WindowCompositor.cpp'
1901--- Nux/WindowCompositor.cpp 2012-09-24 18:50:37 +0000
1902+++ Nux/WindowCompositor.cpp 2012-09-26 05:32:20 +0000
1903@@ -1298,11 +1298,11 @@
1904 else
1905 window_thread_->GetGraphicsEngine().SetOpenGLClippingRectangle(0, 0, buffer_width, buffer_height);
1906
1907- if (m_TooltipText.Size())
1908+ if (m_TooltipText.size())
1909 {
1910 //SetProcessingTopView(_tooltip_window);
1911 GetPainter().PaintShape(window_thread_->GetGraphicsEngine(), _tooltip_geometry, Color(0xA0000000), eSHAPE_CORNER_ROUND10, true);
1912- GetPainter().PaintTextLineStatic(window_thread_->GetGraphicsEngine(), GetSysBoldFont(), _tooltip_text_geometry, m_TooltipText.m_string, Color(0xFFFFFFFF));
1913+ GetPainter().PaintTextLineStatic(window_thread_->GetGraphicsEngine(), GetSysBoldFont(), _tooltip_text_geometry, m_TooltipText, Color(0xFFFFFFFF));
1914 //SetProcessingTopView(NULL);
1915 }
1916
1917@@ -1687,9 +1687,9 @@
1918 m_TooltipX = x;
1919 m_TooltipY = y;
1920
1921- if (m_TooltipText.Size())
1922+ if (m_TooltipText.size())
1923 {
1924- int w = GetSysBoldFont()->GetCharStringWidth(m_TooltipText.GetTCharPtr());
1925+ int w = GetSysBoldFont()->GetCharStringWidth(m_TooltipText.c_str());
1926 int h = GetSysBoldFont()->GetFontHeight();
1927
1928 _tooltip_text_geometry = Geometry(
1929@@ -1790,7 +1790,7 @@
1930 key_focus_area_->key_nav_focus_change.emit(key_focus_area_.GetPointer(), false, direction);
1931 // nuxDebugMsg("[WindowCompositor::SetKeyFocusArea] Area type '%s' named '%s': Lost key nav focus.",
1932 // key_focus_area_->Type().name,
1933- // key_focus_area_->GetBaseString().GetTCharPtr());
1934+ // key_focus_area_->GetBaseString().c_str());
1935 }
1936
1937 if (key_focus_area_->Type().IsDerivedFromType(View::StaticObjectType))
1938@@ -1818,7 +1818,7 @@
1939 key_focus_area_->key_nav_focus_change.emit(key_focus_area_.GetPointer(), true, direction);
1940 // nuxDebugMsg("[WindowCompositor::SetKeyFocusArea] Area type '%s' named '%s': Has key nav focus.",
1941 // key_focus_area_->Type().name,
1942- // key_focus_area_->GetBaseString().GetTCharPtr());
1943+ // key_focus_area_->GetBaseString().c_str());
1944 }
1945
1946 if (key_focus_area_->Type().IsDerivedFromType(View::StaticObjectType))
1947@@ -2108,7 +2108,7 @@
1948 key_focus_area_->key_nav_focus_change.emit(key_focus_area_.GetPointer(), false, KEY_NAV_NONE);
1949 // nuxDebugMsg("[WindowCompositor::GrabKeyboardAdd] Area type '%s' named '%s': Lost key nav focus.",
1950 // key_focus_area_->Type().name,
1951- // key_focus_area_->GetBaseString().GetTCharPtr());
1952+ // key_focus_area_->GetBaseString().c_str());
1953
1954 }
1955
1956@@ -2183,7 +2183,7 @@
1957 key_focus_area_->key_nav_focus_change.emit(key_focus_area_.GetPointer(), false, KEY_NAV_NONE);
1958 // nuxDebugMsg("[WindowCompositor::GrabKeyboardRemove] Area type '%s' named '%s': Lost key nav focus.",
1959 // key_focus_area_->Type().name,
1960- // key_focus_area_->GetBaseString().GetTCharPtr());
1961+ // key_focus_area_->GetBaseString().c_str());
1962 }
1963
1964 if (key_focus_area_->Type().IsDerivedFromType(View::StaticObjectType))
1965
1966=== modified file 'Nux/WindowCompositor.h'
1967--- Nux/WindowCompositor.h 2012-09-24 16:03:12 +0000
1968+++ Nux/WindowCompositor.h 2012-09-26 05:32:20 +0000
1969@@ -487,7 +487,7 @@
1970 int m_Width;
1971 int m_Height;
1972
1973- NString m_TooltipText;
1974+ std::string m_TooltipText;
1975 InputArea* m_TooltipArea;
1976 int m_TooltipX;
1977 int m_TooltipY;
1978
1979=== modified file 'NuxCore/FileIO.cpp'
1980--- NuxCore/FileIO.cpp 2011-10-21 22:06:35 +0000
1981+++ NuxCore/FileIO.cpp 2012-09-26 05:32:20 +0000
1982@@ -232,7 +232,7 @@
1983 Load a text file to an NString. The file maybe ANSI or Unicode.
1984 The resulting string is TCHAR.
1985 */
1986- bool LoadFileToString ( NString &Result, const TCHAR *Filename, NFileManager &FileManager )
1987+ bool LoadFileToString ( std::string &Result, const TCHAR *Filename, NFileManager &FileManager )
1988 {
1989 NSerializer *Reader = FileManager.CreateFileReader (Filename);
1990
1991@@ -318,9 +318,9 @@
1992 /*!
1993 Save string to File. Attempt to write it as ASCII if possible. If not write as UTF16-BE.
1994 */
1995- bool SaveStringToFile ( const NString &String, const TCHAR *Filename, NFileManager &FileManager )
1996+ bool SaveStringToFile ( const std::string &String, const TCHAR *Filename, NFileManager &FileManager )
1997 {
1998- if ( !String.Length() )
1999+ if ( !String.length() )
2000 return 0;
2001
2002 NSerializer *Ar = FileManager.CreateFileWriter ( Filename );
2003@@ -331,7 +331,7 @@
2004 bool SaveAsUnicode = false, Success = true;
2005 #if UNICODE
2006
2007- for ( int i = 0; i < String.Length(); i++ )
2008+ for ( int i = 0; i < String.length(); i++ )
2009 {
2010 // Test if the UNICODE 0xABCD is the same as the ASCII 0x00CB.
2011 if ( (*String) [i] != (TCHAR) (ANSIUCHAR) ConvertTCHARToAnsiChar ( (*String) [i]) )
2012@@ -347,20 +347,20 @@
2013
2014 if ( SaveAsUnicode || (sizeof (TCHAR) == 1) )
2015 {
2016- unsigned int s = (unsigned int) String.Length() * sizeof (TCHAR);
2017- Ar->Serialize ( NUX_CONST_CAST (TCHAR *, String.GetTCharPtr() ), (unsigned int) s);
2018+ unsigned int s = (unsigned int) String.length() * sizeof (TCHAR);
2019+ Ar->Serialize ( NUX_CONST_CAST (TCHAR *, String.c_str() ), (unsigned int) s);
2020 }
2021 else
2022 {
2023- unsigned int s = (unsigned int) String.Length();
2024+ unsigned int s = (unsigned int) String.length();
2025 std::vector<ANSICHAR> AnsiBuffer ( (unsigned int) s);
2026
2027 // Cast all character down from UTF16 to ANSI
2028- for (unsigned int i = 0; i < (unsigned int) String.Length(); i++ )
2029+ for (unsigned int i = 0; i < (unsigned int) String.length(); i++ )
2030 AnsiBuffer[i] = ConvertTCHARToAnsiChar ( (unsigned int) String[i]);
2031
2032 // serialize
2033- s = (unsigned int) String.Length();
2034+ s = (unsigned int) String.length();
2035 Ar->Serialize ( NUX_CONST_CAST (ANSICHAR *, &AnsiBuffer[0]), s);
2036 }
2037
2038
2039=== modified file 'NuxCore/FileIO.h'
2040--- NuxCore/FileIO.h 2011-04-06 21:54:09 +0000
2041+++ NuxCore/FileIO.h 2012-09-26 05:32:20 +0000
2042@@ -23,15 +23,18 @@
2043 #ifndef NFILE_H
2044 #define NFILE_H
2045
2046+#include <vector>
2047+#include <string>
2048+
2049 namespace nux
2050 {
2051
2052 bool LoadFileToArray ( std::vector<BYTE>& Result, const TCHAR *Filename, NFileManager &FileManager = GFileManager );
2053 bool LoadTextFileToAnsiArray ( std::vector<ANSICHAR>& Result, const TCHAR *Filename, NFileManager &FileManager = GFileManager );
2054 bool LoadTextFileToUnicodeArray ( std::vector<UNICHAR>& Result, const TCHAR *Filename, NFileManager &FileManager = GFileManager );
2055- bool LoadFileToString ( NString &Result, const TCHAR *Filename, NFileManager &FileManager = GFileManager );
2056+ bool LoadFileToString ( std::string &Result, const TCHAR *Filename, NFileManager &FileManager = GFileManager );
2057 bool SaveArrayToFile ( const std::vector<BYTE>& Array, const TCHAR *Filename, NFileManager &FileManager = GFileManager );
2058- bool SaveStringToFile ( const NString &String, const TCHAR *Filename, NFileManager &FileManager = GFileManager );
2059+ bool SaveStringToFile ( const std::string &String, const TCHAR *Filename, NFileManager &FileManager = GFileManager );
2060
2061 }
2062
2063
2064=== modified file 'NuxCore/FileManager/NFileManagerGNU.h'
2065--- NuxCore/FileManager/NFileManagerGNU.h 2011-10-21 23:49:15 +0000
2066+++ NuxCore/FileManager/NFileManagerGNU.h 2012-09-26 05:32:20 +0000
2067@@ -127,8 +127,8 @@
2068 bool DeleteDirectory (const TCHAR *Path, bool DeleteContentFirst = false);
2069
2070
2071- void FindFiles (std::vector<NString>& Result, const TCHAR *Filename, bool Files, bool Directories) {};
2072- void ListFilesInDirectory (std::vector<NString>& Result, const TCHAR *DirName) {};
2073+ void FindFiles (std::vector<std::string>& Result, const TCHAR *Filename, bool Files, bool Directories) {};
2074+ void ListFilesInDirectory (std::vector<std::string>& Result, const TCHAR *DirName) {};
2075 double GetFileAgeSeconds (const TCHAR *Filename)
2076 {
2077 return 0;
2078@@ -141,9 +141,9 @@
2079 {
2080 return false;
2081 };
2082- NString GetCurrentDirectory()
2083+ std::string GetCurrentDirectory()
2084 {
2085- return NString();
2086+ return std::string();
2087 };
2088 bool GetTimeStamp (const TCHAR *Filename, FileTimeStamp &Timestamp)
2089 {
2090
2091=== modified file 'NuxCore/FileManager/NFileManagerGeneric.cpp'
2092--- NuxCore/FileManager/NFileManagerGeneric.cpp 2011-10-21 22:06:35 +0000
2093+++ NuxCore/FileManager/NFileManagerGeneric.cpp 2012-09-26 05:32:20 +0000
2094@@ -38,10 +38,10 @@
2095 }
2096
2097 int Result = COPY_OK;
2098- NString SrcFile = InSrcFile;
2099- NString DestFile = InDestFile;
2100+ std::string SrcFile = InSrcFile;
2101+ std::string DestFile = InDestFile;
2102
2103- NSerializer *Src = CreateFileReader (SrcFile.GetTCharPtr() );
2104+ NSerializer *Src = CreateFileReader (SrcFile.c_str() );
2105
2106 if (!Src)
2107 {
2108@@ -50,7 +50,7 @@
2109 else
2110 {
2111 unsigned int Size = Src->GetFileSize();
2112- NSerializer *Dest = CreateFileWriter (DestFile.GetTCharPtr(), (OverWriteExisting ? 0 : FILEWRITE_NOREPLACEEXISTING) | (OverWriteReadOnly ? FILEWRITE_EVENIFREADONLY : 0) );
2113+ NSerializer *Dest = CreateFileWriter (DestFile.c_str(), (OverWriteExisting ? 0 : FILEWRITE_NOREPLACEEXISTING) | (OverWriteReadOnly ? FILEWRITE_EVENIFREADONLY : 0) );
2114
2115 if (!Dest)
2116 {
2117@@ -103,7 +103,7 @@
2118
2119 if (Result != COPY_OK)
2120 {
2121- Delete (DestFile.GetTCharPtr() );
2122+ Delete (DestFile.c_str() );
2123 }
2124 }
2125
2126@@ -190,28 +190,28 @@
2127 if (PathLength == 0)
2128 return false;
2129
2130- NString WildcardPath = NString (Path);
2131+ std::string WildcardPath = std::string (Path);
2132
2133 if ( (WildcardPath[PathLength - 1] != NUX_BACKSLASH_CHAR) && (WildcardPath[PathLength - 1] != NUX_SLASH_CHAR) )
2134 WildcardPath += NUX_BACKSLASH_CHAR;
2135
2136 WildcardPath += TEXT ("*");
2137
2138- std::vector<NString> List;
2139- FindFiles (List, *WildcardPath, 1, 0);
2140+ std::vector<std::string> List;
2141+ FindFiles (List, WildcardPath.c_str(), 1, 0);
2142
2143 for (unsigned int i = 0; i < List.size(); i++)
2144 {
2145- if (!Delete (* (NString (Path) + NUX_BACKSLASH_CHAR + List[i]), 1) )
2146+ if (!Delete ((std::string (Path) + NUX_BACKSLASH_CHAR + List[i]).c_str(), 1) )
2147 return 0;
2148 }
2149
2150 List.clear();
2151- FindFiles (List, *WildcardPath, 0, 1);
2152+ FindFiles (List, WildcardPath.c_str(), 0, 1);
2153
2154 for (unsigned int i = 0; i < List.size(); i++)
2155 {
2156- if (!DeleteDirectory (* (NString (Path) + NUX_BACKSLASH_CHAR + List[i]), true) )
2157+ if (!DeleteDirectory ((std::string (Path) + NUX_BACKSLASH_CHAR + List[i]).c_str(), true) )
2158 return 0;
2159 }
2160
2161@@ -230,13 +230,13 @@
2162 }
2163
2164
2165- int NFileManagerGeneric::CreateUniqueFileName (const TCHAR *Filename, const TCHAR *Extension, NString &OutputFilename, unsigned int BaseIndex)
2166+ int NFileManagerGeneric::CreateUniqueFileName (const TCHAR *Filename, const TCHAR *Extension, std::string &OutputFilename, unsigned int BaseIndex)
2167 {
2168 nuxAssert (Filename);
2169 nuxAssert (Extension);
2170
2171- NString FullPath (Filename);
2172- const size_t IndexMarker = FullPath.Length(); // Marks location of the four-digit index.
2173+ std::string FullPath (Filename);
2174+ const size_t IndexMarker = FullPath.length(); // Marks location of the four-digit index.
2175 FullPath += TEXT ("0000.");
2176 FullPath += Extension;
2177
2178@@ -248,7 +248,7 @@
2179 FullPath[IndexMarker+2] = (i / 10) % 10 + TEXT ('0');
2180 FullPath[IndexMarker+3] = i % 10 + TEXT ('0');
2181
2182- if (GFileManager.FileSize (FullPath.GetTCharPtr() ) == -1)
2183+ if (GFileManager.FileSize (FullPath.c_str() ) == -1)
2184 {
2185 // The file doesn't exist; output success.
2186 OutputFilename = FullPath;
2187
2188=== modified file 'NuxCore/FileManager/NFileManagerGeneric.h'
2189--- NuxCore/FileManager/NFileManagerGeneric.h 2011-10-21 22:06:35 +0000
2190+++ NuxCore/FileManager/NFileManagerGeneric.h 2012-09-26 05:32:20 +0000
2191@@ -26,7 +26,6 @@
2192 namespace nux
2193 {
2194
2195- class NString;
2196 class NFileManagerWindows;
2197
2198 class NFileTransferMonitor
2199@@ -149,15 +148,15 @@
2200 @param BaseIndex Base for index search.
2201 @return Index of the new file. -1 if the file couldn't be created The index has to be in the range [0, 9999].
2202 */
2203- virtual int CreateUniqueFileName (const TCHAR *Filename, const TCHAR *Extension, NString &OutputFilename, unsigned int BaseIndex = 0xffffffff) = 0;
2204-
2205-
2206- virtual void FindFiles ( std::vector<NString>& FileNames, const TCHAR *Filename, bool Files, bool Directories ) = 0;
2207- virtual void ListFilesInDirectory ( std::vector<NString>& Result, const TCHAR *DirName) = 0;
2208+ virtual int CreateUniqueFileName (const TCHAR *Filename, const TCHAR *Extension, std::string &OutputFilename, unsigned int BaseIndex = 0xffffffff) = 0;
2209+
2210+
2211+ virtual void FindFiles ( std::vector<std::string>& FileNames, const TCHAR *Filename, bool Files, bool Directories ) = 0;
2212+ virtual void ListFilesInDirectory ( std::vector<std::string>& Result, const TCHAR *DirName) = 0;
2213 virtual time_t GetFileLastModified (const TCHAR *Filename) = 0;
2214 virtual double GetFileAgeSeconds (const TCHAR *Filename) = 0;
2215 virtual bool SetDefaultDirectory() = 0;
2216- virtual NString GetCurrentDirectory() = 0;
2217+ virtual std::string GetCurrentDirectory() = 0;
2218 virtual bool GetTimeStamp ( const TCHAR *Path, FileTimeStamp &Timestamp ) = 0;
2219
2220
2221@@ -172,7 +171,7 @@
2222 bool MakeDirectory (const TCHAR *Path, bool CreateCompletePath = false);
2223 bool DeleteDirectory (const TCHAR *Path, bool DeleteContentFirst = false);
2224 bool Move (const TCHAR *Dest, const TCHAR *Src, bool OverWriteExisting = true, bool OverWriteReadOnly = false, NFileTransferMonitor *Monitor = NULL);
2225- int CreateUniqueFileName (const TCHAR *Filename, const TCHAR *Extension, NString &OutputFilename, unsigned int BaseIndex = 0xffffffff);
2226+ int CreateUniqueFileName (const TCHAR *Filename, const TCHAR *Extension, std::string &OutputFilename, unsigned int BaseIndex = 0xffffffff);
2227
2228 bool IsDrive (const TCHAR *Path);
2229 };
2230
2231=== modified file 'NuxCore/FileName.cpp'
2232--- NuxCore/FileName.cpp 2011-10-21 22:06:35 +0000
2233+++ NuxCore/FileName.cpp 2012-09-26 05:32:20 +0000
2234@@ -27,72 +27,59 @@
2235 namespace nux
2236 {
2237
2238- NString NFileName::GetDrive() const
2239+ std::string NFileName::GetDrive() const
2240 {
2241- size_t Pos = FindFirstOccurence (NUX_BACKSLASH_CHAR);
2242-
2243- if (Pos == tstring::npos)
2244- {
2245- Pos = FindFirstOccurence ("\\");
2246-
2247- if (Pos != tstring::npos)
2248- {
2249- return GetSubString (Pos);
2250- }
2251- }
2252-
2253- return TEXT ("");
2254+ size_t Pos = find('\\', 0);
2255+ return Pos != std::string::npos ? substr(0, Pos) : "";
2256 }
2257
2258- NString NFileName::GetExtension() const
2259+ std::string NFileName::GetExtension() const
2260 {
2261- size_t Pos = FindLastOccurence (TEXT (".") );
2262-
2263- if (Pos != tstring::npos)
2264- {
2265- return GetSubString (Pos + 1, Length() - Pos - 1);
2266- }
2267-
2268- return TEXT ("");
2269+ size_t Pos = rfind('.');
2270+ return Pos != std::string::npos ? substr(Pos + 1) : "";
2271 }
2272
2273 // Returns the base filename without the path
2274- NString NFileName::GetCleanFilename() const
2275+ std::string NFileName::GetCleanFilename() const
2276 {
2277- size_t Pos = FindLastOccurence (NUX_BACKSLASH_CHAR);
2278- Pos = Max<size_t> (Pos, FindLastOccurence (TEXT ("/") ) ); // in case we are using slash and the NUX_BACKSLASH_CHAR is different.
2279- Pos = Max<size_t> (Pos, FindLastOccurence (TEXT ("\\") ) ); // in case we are using backslash and the NUX_BACKSLASH_CHAR is different.
2280-
2281- if (Pos != tstring::npos)
2282- {
2283- return GetSubString (Pos + 1, Length() - Pos - 1);
2284- }
2285-
2286- return *this;
2287+ size_t bsPos = rfind('\\');
2288+ size_t sPos = rfind('/');
2289+ size_t Pos = std::string::npos;
2290+ if (bsPos != std::string::npos && sPos != std::string::npos)
2291+ {
2292+ Pos = Max<size_t>(bsPos, sPos);
2293+ }
2294+ else if (bsPos != std::string::npos)
2295+ {
2296+ Pos = bsPos;
2297+ }
2298+ else if (sPos != std::string::npos)
2299+ {
2300+ Pos = sPos;
2301+ }
2302+ return Pos != std::string::npos ? (const std::string)substr(Pos + 1) : *this;
2303 }
2304
2305- NString NFileName::GetFilenameNoExtension() const
2306+ std::string NFileName::GetFilenameNoExtension() const
2307 {
2308- size_t Pos = FindLastOccurence (TEXT (".") );
2309-
2310- if (Pos != tstring::npos)
2311+ size_t Pos = rfind('.');
2312+ if (Pos != std::string::npos && Pos != 0)
2313 {
2314- return GetSubString (Pos);
2315+ return substr(0, Pos);
2316 }
2317-
2318 return *this;
2319 }
2320
2321 // Returns the base filename without the path and without the extension
2322- NString NFileName::GetBaseFilename() const
2323+ std::string NFileName::GetBaseFilename() const
2324 {
2325- NString Wk = GetCleanFilename();
2326-
2327- size_t Pos = Wk.FindLastOccurence (TEXT (".") );
2328-
2329- if (Pos != tstring::npos)
2330+ std::string Wk = GetCleanFilename();
2331+
2332+ size_t Pos = Wk.rfind('.');
2333+
2334+ if (Pos != std::string::npos)
2335 {
2336- return Wk.GetSubString (Pos);
2337+ return Wk.substr(Pos);
2338 }
2339
2340 return Wk;
2341@@ -100,113 +87,124 @@
2342
2343 // Returns the path in front of the filename
2344
2345- NString NFileName::GetDirectoryPath() const
2346+ std::string NFileName::GetDirectoryPath() const
2347 {
2348- size_t Pos = FindLastOccurence (NUX_BACKSLASH_CHAR);
2349- Pos = Max<size_t> (Pos, FindLastOccurence (TEXT ("/") ) ); // in case we are using slash and the NUX_BACKSLASH_CHAR is different.
2350- Pos = Max<size_t> (Pos, FindLastOccurence (TEXT ("\\") ) ); // in case we are using backslash and the NUX_BACKSLASH_CHAR is different.
2351-
2352- if (Pos != tstring::npos)
2353- {
2354- return GetSubString (Pos);
2355- }
2356-
2357- return *this;
2358+ size_t bsPos = rfind('\\');
2359+ size_t sPos = rfind('/');
2360+ size_t Pos = std::string::npos;
2361+ if (bsPos != std::string::npos && sPos != std::string::npos)
2362+ {
2363+ Pos = Max<size_t>(bsPos, sPos);
2364+ }
2365+ else if (bsPos != std::string::npos)
2366+ {
2367+ Pos = bsPos;
2368+ }
2369+ else if (sPos != std::string::npos)
2370+ {
2371+ Pos = sPos;
2372+ }
2373+ return Pos != std::string::npos ? substr(Pos) : ".";
2374 }
2375
2376 void NFileName::ChangeFileExtension (const TCHAR *ext)
2377 {
2378- size_t Pos = FindLastOccurence (TEXT (".") );
2379-
2380- if (Pos != tstring::npos)
2381- {
2382- (*this) = GetSubString (Pos) + NString (TEXT (".") ) + NString (ext);
2383- }
2384- else
2385- {
2386- (*this) = (*this) + NString (TEXT (".") ) + NString (ext);
2387- }
2388+ size_t Pos = rfind('.');
2389+ if (Pos != std::string::npos)
2390+ {
2391+ replace(begin() + Pos, end(), ext);
2392+ }
2393+ *this = *this + "." + ext;
2394 }
2395
2396 void NFileName::ConvertSlashToBackslash()
2397 {
2398- size_t Pos = tstring::npos;
2399- Pos = FindFirstOccurence (TEXT ('/') );
2400+ size_t Pos = find('/');
2401
2402- while (Pos != tstring::npos)
2403+ while (Pos != std::string::npos)
2404 {
2405- Replace (Pos, 1, 1, TEXT ('\\') );
2406+ replace(Pos, 1, 1, '\\');
2407 }
2408 }
2409
2410-
2411 void NFileName::ConvertBackslashToSlash()
2412 {
2413- size_t Pos = tstring::npos;
2414- Pos = FindFirstOccurence (TEXT ('\\') );
2415+ size_t Pos = find('\\');
2416
2417- while (Pos != tstring::npos)
2418+ while (Pos != std::string::npos)
2419 {
2420- Replace (Pos, 1, 1, TEXT ('/') );
2421+ replace(Pos, 1, 1, '/');
2422 }
2423 }
2424
2425 void NFileName::AddSlashAtEnd()
2426 {
2427- if (GetLastChar() != TEXT ('/') )
2428- *this += TEXT ('/');
2429+ if (!empty() && operator[](size() - 1) != '/')
2430+ append("/");
2431 }
2432
2433 void NFileName::AddBackSlashAtEnd()
2434 {
2435- if (GetLastChar() != TEXT ('\\') )
2436- *this += TEXT ('\\');
2437+ if (!empty() && operator[](size() - 1) != '\\')
2438+ *this += '\\';
2439 }
2440
2441 void NFileName::AddSlashAtStart()
2442 {
2443- if (GetFirstChar() != TEXT ('/') )
2444- Insert (0, 1, TEXT ('/') );
2445+ if (!empty() && operator[](0) != '/')
2446+ insert(0, 1, '/');
2447 }
2448
2449 void NFileName::AddBackSlashAtStart()
2450 {
2451- if (GetFirstChar() != TEXT ('\\') )
2452- Insert (0, 1, TEXT ('\\') );
2453+ if (!empty() && operator[](0) != '\\')
2454+ insert(0, 1, '\\');
2455 }
2456
2457 void NFileName::RemoveSlashAtEnd()
2458 {
2459- RemoveSuffix (TEXT ('/') );
2460+ if (!empty() && operator[](size() - 1) == '/')
2461+ {
2462+ erase(end() - 1);
2463+ }
2464 }
2465
2466 void NFileName::RemoveBackSlashAtEnd()
2467 {
2468- RemoveSuffix (TEXT ('\\') );
2469+ if (!empty() && operator[](size() - 1) == '\\')
2470+ {
2471+ erase(end() - 1);
2472+ }
2473 }
2474
2475 void NFileName::RemoveSlashAtStart()
2476 {
2477- RemovePrefix (TEXT ('/') );
2478+ if (!empty() && operator[](0) == '/')
2479+ {
2480+ erase(0, 1);
2481+ }
2482 }
2483
2484 void NFileName::RemoveBackSlashAtStart()
2485 {
2486- RemovePrefix (TEXT ('\\') );
2487+ if (!empty() && operator[](0) == '\\')
2488+ {
2489+ erase(0, 1);
2490+ }
2491 }
2492
2493 void NFileName::ConvertToCleanSlash()
2494 {
2495 ConvertBackslashToSlash();
2496
2497- size_t size = Size();
2498+ size_t count = size();
2499
2500- for (size_t i = 0; i < size; )
2501+ for (size_t i = 0; i < count; )
2502 {
2503- if ( (i < size - 1) && (operator[] (i) == TEXT ('/') ) && (operator[] (i + 1) == TEXT ('/') ) )
2504+ if ( (i < count - 1) && (operator[] (i) == '/' ) && (operator[] (i + 1) == ('/') ) )
2505 {
2506- Erase (i + 1, 1);
2507- --size;
2508+ erase (i + 1, 1);
2509+ --count;
2510 }
2511 else
2512 {
2513@@ -219,13 +217,13 @@
2514 {
2515 ConvertSlashToBackslash();
2516
2517- size_t size = Size();
2518+ size_t count = size();
2519
2520- for (size_t i = 0; i < size; )
2521+ for (size_t i = 0; i < count; )
2522 {
2523- if ( (i < size - 1) && (operator[] (i) == TEXT ('\\') ) && (operator[] (i + 1) == TEXT ('\\') ) )
2524+ if ( (i < count - 1) && (operator[] (i) == '\\' ) && (operator[] (i + 1) == '\\' ) )
2525 {
2526- Erase (i + 1, 1);
2527+ erase (i + 1, 1);
2528 }
2529 else
2530 {
2531
2532=== modified file 'NuxCore/FileName.h'
2533--- NuxCore/FileName.h 2011-04-06 21:54:09 +0000
2534+++ NuxCore/FileName.h 2012-09-26 05:32:20 +0000
2535@@ -28,25 +28,22 @@
2536 namespace nux
2537 {
2538
2539- class NFileName : public NString
2540+ class NFileName : public std::string
2541 {
2542 public:
2543 NFileName()
2544- : NString()
2545+ : std::string()
2546 {}
2547 NFileName ( const NFileName &Filename )
2548- : NString ( Filename.GetTCharPtr() )
2549+ : std::string ( Filename )
2550 {}
2551
2552- NFileName ( const NString &str )
2553- : NString ( str )
2554+ NFileName ( const std::string &str )
2555+ : std::string ( str )
2556 {}
2557
2558 NFileName ( const ANSICHAR *str )
2559- : NString ( str )
2560- {}
2561- NFileName ( const UNICHAR *str )
2562- : NString ( str )
2563+ : std::string ( str )
2564 {}
2565
2566 //! Replace all slash with backslash.
2567@@ -75,18 +72,18 @@
2568 //! Replace all slash with backslash. Replace multiple consecutive backslash with one backslash.
2569 void ConvertToCleanBackslash();
2570
2571- NString GetDrive() const;
2572+ std::string GetDrive() const;
2573 //! Returns the text following the last period.
2574- NString GetExtension() const;
2575+ std::string GetExtension() const;
2576 //! Returns the base filename, minus any path information.
2577- NString GetCleanFilename() const;
2578+ std::string GetCleanFilename() const;
2579 //! Returns the base filename, without the extension (keep the path)
2580- NString GetFilenameNoExtension() const;
2581+ std::string GetFilenameNoExtension() const;
2582
2583 //! Returns the same thing as GetCleanFilename, but without the extension
2584- NString GetBaseFilename() const;
2585+ std::string GetBaseFilename() const;
2586 //! Returns the path in front of the filename
2587- NString GetDirectoryPath() const;
2588+ std::string GetDirectoryPath() const;
2589 //! Change the file extension. Do not start ext with a dot character '.'.
2590 //! ie ext = "com"
2591 void ChangeFileExtension (const TCHAR *ext);
2592
2593=== modified file 'NuxCore/FilePath.cpp'
2594--- NuxCore/FilePath.cpp 2011-10-21 22:06:35 +0000
2595+++ NuxCore/FilePath.cpp 2012-09-26 05:32:20 +0000
2596@@ -40,7 +40,7 @@
2597
2598 }
2599
2600- void FilePath::AddSearchPath (const NString &searchpath)
2601+ void FilePath::AddSearchPath (const std::string &searchpath)
2602 {
2603 if (std::find (m_SearchPath.begin(), m_SearchPath.end(), searchpath) != m_SearchPath.end() )
2604 return;
2605@@ -48,7 +48,7 @@
2606 m_SearchPath.push_back (searchpath);
2607 }
2608
2609- void FilePath::AddSearchPath (const std::vector<NString>& searchpath)
2610+ void FilePath::AddSearchPath (const std::vector<std::string>& searchpath)
2611 {
2612 for (unsigned int i = 0; i < searchpath.size(); i++)
2613 {
2614@@ -57,51 +57,52 @@
2615 }
2616 }
2617
2618- NString FilePath::GetPathToFile (const TCHAR *filename) const
2619+ std::string FilePath::GetPathToFile (const TCHAR *filename) const
2620 {
2621- NString FileName = GetFile (filename);
2622-
2623- int loc = (int) FileName.FindLastOccurence (TEXT ('\\') );
2624-
2625- if (loc == -1)
2626+ std::string FileName = GetFile (filename);
2627+
2628+ size_t loc = FileName.rfind(TEXT('\\'), 0);
2629+
2630+ if (loc == std::string::npos)
2631 {
2632- loc = (int) FileName.FindLastOccurence (TEXT ('/') );
2633+ loc = FileName.rfind(TEXT('/'), 0);
2634 }
2635
2636- if (loc != -1)
2637- FileName = FileName.GetSubString (0, loc);
2638+ if (loc != std::string::npos)
2639+ FileName = FileName.substr(0, loc);
2640 else
2641- FileName = NString (TEXT (".") );
2642+ FileName = std::string(TEXT ("."));
2643
2644 return FileName;
2645 }
2646
2647- NString FilePath::GetFile (const TCHAR *filename) const
2648+ std::string FilePath::GetFile (const TCHAR *filename) const
2649 {
2650- NUX_RETURN_VALUE_IF_NULL (filename, NString (TEXT ("") ) );
2651-
2652- if (NString (filename) == NString (TEXT ("") ) )
2653- return NString (TEXT ("") );
2654-
2655- NString FileName = filename;
2656-
2657- if (GFileManager.FileExist (FileName.GetTCharPtr() ) )
2658+ NUX_RETURN_VALUE_IF_NULL (filename, std::string (TEXT ("") ) );
2659+
2660+ if (std::string (filename) == std::string (TEXT ("") ) )
2661+ return std::string (TEXT ("") );
2662+
2663+ std::string FileName = filename;
2664+
2665+ if (GFileManager.FileExist(FileName.c_str() ) )
2666 return FileName;
2667
2668 for (unsigned int i = 0; i < m_SearchPath.size(); i++)
2669 {
2670- if (m_SearchPath[i].Size() == 0)
2671+ if (m_SearchPath[i].size() == 0)
2672 continue;
2673
2674- NString FilePath;
2675+ std::string FilePath;
2676
2677- if ((m_SearchPath[i].GetLastChar () == TEXT('/')) || (m_SearchPath[i].GetLastChar () == TEXT('\\')))
2678+ char last = m_SearchPath[i][m_SearchPath.size() - 1];
2679+ if (last == TEXT('/') || last == TEXT('\\'))
2680 FilePath = m_SearchPath[i] + filename;
2681 else
2682 FilePath = m_SearchPath[i] + NUX_PATH_SEPARATOR_STRING + filename;
2683
2684
2685- if (GFileManager.FileExist (FilePath.GetTCharPtr() ) )
2686+ if (GFileManager.FileExist (FilePath.c_str() ) )
2687 return FilePath;
2688 }
2689
2690@@ -123,27 +124,28 @@
2691 for (size_t i = 0; i < m_SearchPath.size(); i++)
2692 {
2693 size_t pos;
2694- NString PathName;
2695+ std::string PathName;
2696
2697- while (FileName.FindFirstOccurenceOf (TEXT ("\\/") ) != std::string::npos)
2698+ while (FileName.find_first_of(TEXT ("\\/")) != std::string::npos)
2699 {
2700- pos = FileName.FindFirstOccurenceOf (TEXT ("\\/") ) + 1;
2701-
2702- FileName = FileName.GetSubString (pos, FileName.Length() - pos);
2703-
2704- if ((m_SearchPath[i].GetLastChar () == TEXT('/')) || (m_SearchPath[i].GetLastChar () == TEXT('\\')))
2705+ pos = FileName.find_first_of(TEXT ("\\/")) + 1;
2706+
2707+ FileName = FileName.substr(pos, FileName.length() - pos);
2708+
2709+ char last = m_SearchPath[i][m_SearchPath[i].size() - 1];
2710+ if (last == TEXT('/') || last == TEXT('\\'))
2711 PathName = m_SearchPath[i] + FileName;
2712 else
2713 PathName = m_SearchPath[i] + NUX_PATH_SEPARATOR_STRING + FileName;
2714
2715
2716- if (GFileManager.FileExist (PathName.GetTCharPtr() ) )
2717+ if (GFileManager.FileExist (PathName.c_str() ) )
2718 return PathName;
2719 }
2720 }
2721
2722 nuxDebugMsg (TEXT ("[FilePath::GetFile] Cannot find file: %s"), filename);
2723- return NString (TEXT ("") );
2724+ return std::string (TEXT ("") );
2725 }
2726
2727 }
2728
2729=== modified file 'NuxCore/FilePath.h'
2730--- NuxCore/FilePath.h 2011-04-06 21:54:09 +0000
2731+++ NuxCore/FilePath.h 2012-09-26 05:32:20 +0000
2732@@ -47,14 +47,14 @@
2733 FilePath();
2734 ~FilePath();
2735
2736- void AddSearchPath (const NString &searchpath);
2737- void AddSearchPath (const std::vector<NString>& searchpath);
2738+ void AddSearchPath (const std::string &searchpath);
2739+ void AddSearchPath (const std::vector<std::string>& searchpath);
2740
2741- NString GetPathToFile (const TCHAR *filename) const;
2742- NString GetFile (const TCHAR *filename) const;
2743+ std::string GetPathToFile (const TCHAR *filename) const;
2744+ std::string GetFile (const TCHAR *filename) const;
2745
2746 private:
2747- std::vector<NString> m_SearchPath;
2748+ std::vector<std::string> m_SearchPath;
2749 };
2750
2751 }
2752
2753=== modified file 'NuxCore/NumberConversion.cpp'
2754--- NuxCore/NumberConversion.cpp 2011-10-21 22:06:35 +0000
2755+++ NuxCore/NumberConversion.cpp 2012-09-26 05:32:20 +0000
2756@@ -31,7 +31,7 @@
2757 * Written by Lukás Chmela
2758 * Released under GPLv3.
2759 */
2760- NString IntegerToChar (int value, int base)
2761+ std::string IntegerToChar (int value, int base)
2762 {
2763 char result[65];
2764
2765@@ -39,7 +39,7 @@
2766 if (base < 2 || base > 36)
2767 {
2768 //*result = '\0';
2769- NString str = TEXT ('\0');
2770+ std::string str = TEXT ('\0');
2771 return str;
2772 }
2773
2774@@ -67,16 +67,16 @@
2775 *ptr1++ = tmp_char;
2776 }
2777
2778- NString str = result;
2779+ std::string str = result;
2780 return str;
2781 }
2782
2783 double CharToDouble (const TCHAR *digit)
2784 {
2785 char *endptr = NULL;
2786- NString str = TCHAR_TO_ANSICHAR (digit);
2787+ std::string str = TCHAR_TO_ANSICHAR (digit);
2788 errno = 0;
2789- double ret = std::strtod (str.GetTCharPtr(), &endptr);
2790+ double ret = std::strtod (str.c_str(), &endptr);
2791 unsigned int error = errno;
2792
2793 if (error == ERANGE)
2794@@ -87,13 +87,16 @@
2795 return ret;
2796 }
2797
2798- NString DoubleToChar (double d)
2799+ std::string DoubleToChar (double d)
2800 {
2801 TCHAR *buffer = new TCHAR[64];
2802 Memset (buffer, 0, 64);
2803 SPRINTF_S (buffer, 64, "%.39f", d);
2804- NString str = buffer;
2805- str = str.TrimRight (TEXT ("0") );
2806+ std::string str = buffer;
2807+ while (!str.empty() && str[str.size() - 1] == '0')
2808+ {
2809+ str.erase(str.end() - 1);
2810+ }
2811
2812 delete[] buffer;
2813 return str;
2814@@ -101,8 +104,8 @@
2815
2816 int CharToInteger (const TCHAR *digit)
2817 {
2818- NString str = TCHAR_TO_ANSICHAR (digit);
2819- long long ret = std::atoi (str.GetTCharPtr() );
2820+ std::string str = TCHAR_TO_ANSICHAR (digit);
2821+ long long ret = std::atoi (str.c_str() );
2822 return ret;
2823 }
2824
2825
2826=== modified file 'NuxCore/NumberConversion.h'
2827--- NuxCore/NumberConversion.h 2011-10-21 22:06:35 +0000
2828+++ NuxCore/NumberConversion.h 2012-09-26 05:32:20 +0000
2829@@ -26,8 +26,6 @@
2830 namespace nux
2831 {
2832
2833- class NString;
2834-
2835 //! Convert a TCHAR string to a double value.
2836 /*!
2837 @param digit A TCHAR string.
2838@@ -35,12 +33,12 @@
2839 */
2840 double CharToDouble (const TCHAR *digit);
2841
2842-//! Convert a double to an NString.
2843+//! Convert a double to an std::string.
2844 /*!
2845 @param d A double value.
2846- @return An NString.
2847+ @return An std::string.
2848 */
2849- NString DoubleToChar (double d);
2850+ std::string DoubleToChar (double d);
2851
2852 //! Convert a TCHAR string to a 32 bits long value.
2853 /*!
2854@@ -55,7 +53,7 @@
2855 @param base Base of the integer representation.
2856 @return A string.
2857 */
2858- NString IntegerToChar (int value, int base = 10);
2859+ std::string IntegerToChar (int value, int base = 10);
2860
2861 //! Convert an string to an integer.
2862 /*!
2863
2864=== modified file 'NuxCore/OutputDevice.cpp'
2865--- NuxCore/OutputDevice.cpp 2011-10-21 22:06:35 +0000
2866+++ NuxCore/OutputDevice.cpp 2012-09-26 05:32:20 +0000
2867@@ -23,6 +23,9 @@
2868 #include "NuxCore.h"
2869 #include "Parsing.h"
2870
2871+#include <sstream>
2872+#include <iomanip>
2873+
2874 namespace nux
2875 {
2876
2877@@ -38,20 +41,35 @@
2878 // Create string with system time to create a unique filename.
2879 unsigned int Year, Month, Day, Hour, Min, Sec, MSec;
2880 GetLocalTime (Year, Month, Day, Hour, Min, Sec, MSec);
2881- NString Name, Extension;
2882- NString (Filename).SplitAtLastOccurenceOf (TEXT ("."), Name, Extension);
2883- NString BackupFilename;
2884-
2885- if (Extension.Size() )
2886+ std::string Name, Extension;
2887+ std::string file = Filename;
2888+ size_t pos = file.rfind('.');
2889+ if (pos != std::string::npos)
2890 {
2891- BackupFilename = NString::Printf (TEXT ("%s-backup-%i.%02i.%02i-%02i.%02i.%02i.%s"), Name.GetTCharPtr(), Year, Month, Day, Hour, Min, Sec, Extension.GetTCharPtr() );
2892+ Name = file.substr(0, pos);
2893+ Extension = file.substr(pos + 1);
2894 }
2895 else
2896 {
2897- BackupFilename = NString::Printf (TEXT ("%s-backup-%i.%02i.%02i-%02i.%02i.%02i"), Name.GetTCharPtr(), Year, Month, Day, Hour, Min, Sec);
2898- }
2899-
2900- GFileManager.Copy (BackupFilename.GetTCharPtr(), Filename, true, true, NULL);
2901+ Name = file;
2902+ }
2903+
2904+ std::ostringstream s;
2905+ s << std::setfill('0')
2906+ << Name << "-backup-" << Year << "."
2907+ << std::setw(2) << Month << "."
2908+ << std::setw(2) << Day << "."
2909+ << std::setw(2) << Hour << "."
2910+ << std::setw(2) << Min << "."
2911+ << std::setw(2) << Sec;
2912+ if (Extension.size() )
2913+ {
2914+ s << "." << Extension;
2915+ }
2916+
2917+ std::string BackupFilename = s.str();
2918+
2919+ GFileManager.Copy (BackupFilename.c_str(), Filename, true, true, NULL);
2920 }
2921 }
2922 #endif
2923@@ -142,13 +160,13 @@
2924 // The Editor requires a fully qualified directory to not end up putting the log in various directories.
2925 m_Filename = GetProgramDirectory();
2926
2927- if ( (m_Filename[m_Filename.Size()-1] != NUX_SLASH_CHAR) || (m_Filename[m_Filename.Size()-1] != NUX_BACKSLASH_CHAR) )
2928+ if ( (m_Filename[m_Filename.size()-1] != NUX_SLASH_CHAR) || (m_Filename[m_Filename.size()-1] != NUX_BACKSLASH_CHAR) )
2929 m_Filename += (const TCHAR *) NUX_PATH_SEPARATOR_STRING;
2930
2931 m_Filename += GetLogDirectory();
2932
2933 // Create the directory tree where the Logs file will be stored.
2934- GFileManager.MakeDirectory (m_Filename.GetTCharPtr(), 1);
2935+ GFileManager.MakeDirectory (m_Filename.c_str(), 1);
2936
2937 m_Filename += (const TCHAR *) NUX_PATH_SEPARATOR_STRING;
2938 m_Filename += TEXT ("nux");
2939@@ -157,11 +175,11 @@
2940 // if the file already exists, create a backup as we are going to overwrite it
2941 if (!m_Opened)
2942 {
2943- CreateBackupCopy (m_Filename.GetTCharPtr() );
2944+ CreateBackupCopy (m_Filename.c_str() );
2945 }
2946
2947 // Open log file.
2948- m_LogSerializer = GFileManager.CreateFileWriter (m_Filename.GetTCharPtr(), NSerializer::Read | NSerializer::Write | NSerializer::OverWriteReadOnly | (m_Opened ? NSerializer::Append : 0) );
2949+ m_LogSerializer = GFileManager.CreateFileWriter (m_Filename.c_str(), NSerializer::Read | NSerializer::Write | NSerializer::OverWriteReadOnly | (m_Opened ? NSerializer::Append : 0) );
2950
2951 if (m_LogSerializer)
2952 {
2953@@ -169,7 +187,7 @@
2954 #if UNICODE && !NUX_LOG_FILE_ANSI
2955 m_LogSerializer->Serialize ( (void *) &NUX_UTF16_BE[1], NUX_UTF16_BE[0] /*size*/ );
2956 #endif
2957- LogFunction (NUX_MSG_SEVERITY_NONE, TEXT ("Log file open, %s"), GetFormattedLocalTime().GetTCharPtr());
2958+ LogFunction (NUX_MSG_SEVERITY_NONE, TEXT ("Log file open, %s"), GetFormattedLocalTime().c_str());
2959 }
2960 else
2961 {
2962@@ -193,7 +211,7 @@
2963 {
2964 if (m_LogSerializer)
2965 {
2966- LogFunction (NUX_MSG_SEVERITY_NONE, TEXT ("Log file closed, %s"), GetFormattedLocalTime().GetTCharPtr());
2967+ LogFunction (NUX_MSG_SEVERITY_NONE, TEXT ("Log file closed, %s"), GetFormattedLocalTime().c_str());
2968 Flush();
2969 delete m_LogSerializer;
2970 m_LogSerializer = NULL;
2971@@ -249,8 +267,8 @@
2972
2973 m_LogSerializer->Serialize (ACh, i);
2974 #else
2975- NString Raw = NString (log_prefix) + NString (TEXT (": ") ) + NString (log_data) + NString (NUX_LINE_TERMINATOR);
2976- SerializeRaw (Raw.GetTCharPtr() );
2977+ std::string Raw = std::string (log_prefix) + std::string (TEXT (": ") ) + std::string (log_data) + std::string (NUX_LINE_TERMINATOR);
2978+ SerializeRaw (Raw.c_str() );
2979 #endif
2980 }
2981 }
2982
2983=== modified file 'NuxCore/OutputDevice.h'
2984--- NuxCore/OutputDevice.h 2011-04-06 21:54:09 +0000
2985+++ NuxCore/OutputDevice.h 2012-09-26 05:32:20 +0000
2986@@ -84,7 +84,7 @@
2987
2988 private:
2989 NSerializer *m_LogSerializer;
2990- NString m_Filename;
2991+ std::string m_Filename;
2992 bool m_Opened;
2993 bool m_Closed;
2994
2995
2996=== modified file 'NuxCore/Parsing.cpp'
2997--- NuxCore/Parsing.cpp 2012-07-30 21:35:43 +0000
2998+++ NuxCore/Parsing.cpp 2012-09-26 05:32:20 +0000
2999@@ -133,7 +133,7 @@
3000 return false;
3001 }
3002
3003- bool Parse_string (const TCHAR *Stream, const TCHAR *Match, NString &Value)
3004+ bool Parse_string (const TCHAR *Stream, const TCHAR *Match, std::string &Value)
3005 {
3006 TCHAR Temp[4096] = TEXT ("");
3007
3008@@ -336,9 +336,9 @@
3009 return sz != 0;
3010 }
3011
3012- bool ParseToken (const TCHAR *Str, NString &TokenString)
3013+ bool ParseToken (const TCHAR *Str, std::string &TokenString)
3014 {
3015- TokenString.Clear();
3016+ TokenString.clear();
3017
3018 // Skip spaces and tabs.
3019 while (IsWhitespaceChar (*Str) )
3020@@ -367,10 +367,10 @@
3021 }
3022 }
3023
3024- return TokenString.Length() > 0;
3025+ return TokenString.length() > 0;
3026 }
3027
3028- NString ParseToken (const TCHAR *Str, bool UseEscape)
3029+ std::string ParseToken (const TCHAR *Str, bool UseEscape)
3030 {
3031 TCHAR Buffer[1024];
3032
3033@@ -398,16 +398,16 @@
3034 return LineBuffer[0] != 0;
3035 }
3036
3037- bool ParseLine (const TCHAR **Stream, NString &LineString)
3038+ bool ParseLine (const TCHAR **Stream, std::string &LineString)
3039 {
3040- LineString.Clear();
3041+ LineString.clear();
3042
3043 while ( (**Stream != 0) && (**Stream != CHAR_NEW_LINE) && (**Stream != CHAR_CR) && (**Stream != CHAR_FF) )
3044 {
3045 LineString += **Stream++;
3046 }
3047
3048- return LineString.Size() > 0;
3049+ return LineString.size() > 0;
3050 }
3051
3052 }
3053
3054=== modified file 'NuxCore/Parsing.h'
3055--- NuxCore/Parsing.h 2011-10-21 22:06:35 +0000
3056+++ NuxCore/Parsing.h 2012-09-26 05:32:20 +0000
3057@@ -112,15 +112,15 @@
3058 @return TRUE if the token is found inside the stream.
3059 */
3060 bool Parse_int (const TCHAR *Stream, const TCHAR *Match, int &Value);
3061-//! Parse a NString after the named token.
3062+//! Parse a std::string after the named token.
3063 /*!
3064- Parse a NString after the named token.
3065+ Parse a std::string after the named token.
3066 @param Stream Character stream to search.
3067 @param Match Token to match.
3068- @param Value parsed NString
3069+ @param Value parsed std::string
3070 @return TRUE if the token is found inside the stream.
3071 */
3072- bool Parse_string (const TCHAR *Stream, const TCHAR *Match, NString &Value);
3073+ bool Parse_string (const TCHAR *Stream, const TCHAR *Match, std::string &Value);
3074 //! Parse a QUADWORD after the named token.
3075 /*!
3076 Parse a QUADWORD after the named token.
3077@@ -168,7 +168,7 @@
3078 If FALSE advanced the pointer past all the CR/LF character at the end of the string.
3079 @return True i a line was copied to LineString;
3080 */
3081- bool ParseLine (const TCHAR **Stream, NString &LineString);
3082+ bool ParseLine (const TCHAR **Stream, std::string &LineString);
3083
3084 //! Parse the next space-delimited string from the input stream. If the next token starts with a quote, gets entire quoted string.
3085 /*!
3086@@ -185,14 +185,14 @@
3087 @param TokenBuffer The parsed token string.
3088 @return True if a token was found.
3089 */
3090- bool ParseToken (const TCHAR *Str, NString &TokenString);
3091+ bool ParseToken (const TCHAR *Str, std::string &TokenString);
3092
3093 //! Parse the next space-delimited string from the input stream. If the next token starts with a quote, gets entire quoted string.
3094 /*!
3095 @param Str stream of characters to parse.
3096- @return The next token in a NString.
3097+ @return The next token in a std::string.
3098 */
3099- NString ParseToken (const TCHAR *Str);
3100+ std::string ParseToken (const TCHAR *Str);
3101
3102 //! Go to the next token in the stream.
3103 /*!
3104
3105=== modified file 'NuxCore/Platform.cpp'
3106--- NuxCore/Platform.cpp 2011-10-21 22:06:35 +0000
3107+++ NuxCore/Platform.cpp 2012-09-26 05:32:20 +0000
3108@@ -60,7 +60,7 @@
3109
3110 }
3111
3112- static NString _GetProgramDirectory()
3113+ static std::string _GetProgramDirectory()
3114 {
3115 #if defined(NUX_OS_WINDOWS)
3116 TCHAR RootDirectory[NUX_MAX_FILEPATH_SIZE] = TEXT ("");
3117@@ -71,7 +71,7 @@
3118 nuxAssertMsg (Result, TEXT ("[GetProgramDirectory] Can't get program's directory path.") );
3119
3120 if (Result == 0)
3121- NString (TEXT ("Unknown Program Directory") );
3122+ std::string (TEXT ("Unknown Program Directory") );
3123
3124 unsigned int i;
3125
3126@@ -85,7 +85,7 @@
3127 RootDirectory[i] = 0;
3128 }
3129
3130- return NString (RootDirectory);
3131+ return std::string (RootDirectory);
3132
3133 #elif defined(NUX_OS_LINUX)
3134
3135@@ -97,19 +97,19 @@
3136 nuxAssertMsg (Result, TEXT ("[GetProgramDirectory] Can't get program's directory path.") );
3137
3138 if (Result == 0)
3139- NString (TEXT ("Unknown Program Directory") );
3140+ std::string (TEXT ("Unknown Program Directory") );
3141
3142 }
3143
3144 nuxDebugMsg (TEXT ("[GetProgramDirectory] Program directory path: %s"), RootDirectory);
3145- return NString (RootDirectory);
3146+ return std::string (RootDirectory);
3147
3148 #else
3149- return NString (TEXT ("Unknown Program Directory") );
3150+ return std::string (TEXT ("Unknown Program Directory") );
3151 #endif
3152 }
3153
3154- static NString _GetComputerName()
3155+ static std::string _GetComputerName()
3156 {
3157 #if defined(NUX_OS_WINDOWS)
3158 TCHAR ComputerName[NUX_MAX_FILEPATH_SIZE] = TEXT ("");
3159@@ -130,7 +130,7 @@
3160 *d++ = 0;
3161 }
3162
3163- return NString (ComputerName);
3164+ return std::string (ComputerName);
3165
3166 #elif defined(NUX_OS_LINUX)
3167 char Buffer[NUX_MAX_FILEPATH_SIZE];
3168@@ -138,18 +138,18 @@
3169
3170 if (gethostname (Buffer, BufferSize) != -1)
3171 {
3172- return NString (Buffer);
3173+ return std::string (Buffer);
3174 }
3175
3176- return NString (TEXT ("Unknown Computer Name") );
3177+ return std::string (TEXT ("Unknown Computer Name") );
3178
3179 #else
3180- return NString (TEXT ("Unknown Computer Name") );
3181+ return std::string (TEXT ("Unknown Computer Name") );
3182 #endif
3183 }
3184
3185 // Get user name. NOTE: Only one return value is valid at a time!
3186- static NString _GetUserName()
3187+ static std::string _GetUserName()
3188 {
3189 #if defined(NUX_OS_WINDOWS)
3190 TCHAR UserName[256] = TEXT ("");
3191@@ -167,19 +167,19 @@
3192 *d++ = 0;
3193 }
3194
3195- return NString (UserName);
3196+ return std::string (UserName);
3197
3198 #elif defined(NUX_OS_LINUX)
3199 struct passwd *userinfo;
3200 userinfo = getpwuid (getuid() );
3201
3202 if (userinfo == 0)
3203- return NString (TEXT ("Unknown User") );
3204+ return std::string (TEXT ("Unknown User") );
3205
3206- return NString (userinfo->pw_name);
3207+ return std::string (userinfo->pw_name);
3208
3209 #else
3210- return return NString (TEXT ("Unknown User") );
3211+ return return std::string (TEXT ("Unknown User") );
3212 #endif
3213 }
3214
3215@@ -203,27 +203,27 @@
3216
3217 }
3218
3219- NString GetComputerName()
3220+ std::string GetComputerName()
3221 {
3222 return NUX_GLOBAL_OBJECT_INSTANCE (NGlobalData).m_ComputerName;
3223 }
3224
3225- NString GetProgramDirectory()
3226+ std::string GetProgramDirectory()
3227 {
3228 return NUX_GLOBAL_OBJECT_INSTANCE (NGlobalData).m_ProgramDirectory;
3229 }
3230
3231- NString GetUserName()
3232+ std::string GetUserName()
3233 {
3234 return NUX_GLOBAL_OBJECT_INSTANCE (NGlobalData).m_UserName;
3235 }
3236
3237- NString GetCmdLine()
3238+ std::string GetCmdLine()
3239 {
3240 return NUX_GLOBAL_OBJECT_INSTANCE (NGlobalData).m_CommandLine;
3241 }
3242
3243- NString GetLogDirectory()
3244+ std::string GetLogDirectory()
3245 {
3246 return TEXT ("Logs");
3247 }
3248
3249=== modified file 'NuxCore/Platform.h'
3250--- NuxCore/Platform.h 2011-10-21 22:06:35 +0000
3251+++ NuxCore/Platform.h 2012-09-26 05:32:20 +0000
3252@@ -43,28 +43,28 @@
3253 Get the program command line.
3254 @return The program command line.
3255 */
3256- NString GetCmdLine();
3257+ std::string GetCmdLine();
3258
3259 //! Get startup directory.
3260 /*!
3261 Get startup directory.
3262 @return The computer name.
3263 */
3264- NString GetProgramDirectory();
3265+ std::string GetProgramDirectory();
3266
3267 //! Get computer name.
3268 /*!
3269 Get computer name.
3270 @return The computer name.
3271 */
3272- NString GetComputerName();
3273+ std::string GetComputerName();
3274
3275 //! Get user name.
3276 /*!
3277 Get the user name.
3278 @return The user name.
3279 */
3280- NString GetUserName();
3281+ std::string GetUserName();
3282
3283
3284 //! Return the logs directory
3285@@ -74,7 +74,7 @@
3286
3287 @return The logs directory
3288 */
3289- NString GetLogDirectory();
3290+ std::string GetLogDirectory();
3291
3292 class NGlobalData
3293 {
3294@@ -84,11 +84,11 @@
3295 void Initialize (const TCHAR *CommandLine);
3296
3297 unsigned int m_RandomSeed;
3298- NString m_UserName;
3299- NString m_ComputerName;
3300- NString m_ProgramName;
3301- NString m_ProgramDirectory;
3302- NString m_CommandLine;
3303+ std::string m_UserName;
3304+ std::string m_ComputerName;
3305+ std::string m_ProgramName;
3306+ std::string m_ProgramDirectory;
3307+ std::string m_CommandLine;
3308 };
3309
3310 }
3311
3312=== modified file 'NuxCore/TextString.cpp'
3313--- NuxCore/TextString.cpp 2012-09-19 04:53:45 +0000
3314+++ NuxCore/TextString.cpp 2012-09-26 05:32:20 +0000
3315@@ -35,25 +35,6 @@
3316 return Dest;
3317 }
3318
3319-//
3320-// Concatenate a string with length checking
3321-//
3322- TCHAR *Strncat (TCHAR *Dest, size_t Size, const TCHAR *Src, size_t MaxLen)
3323- {
3324- size_t Len = StringLength (Dest);
3325- nuxAssert (Size >= Len);
3326- TCHAR *NewDest = Dest + Len;
3327-
3328- if ( (MaxLen -= Len) > 0)
3329- {
3330- Strncpy (NewDest, Size - Len, Src, MaxLen);
3331- NewDest[MaxLen-1] = 0;
3332- }
3333-
3334- return Dest;
3335- }
3336-
3337-
3338 // Search a string inside a string. Return a pointer to the beginning of the searched string if it is found. Else, return NULL;
3339 // The shearched string must be preceded by a non alpha numeric character in Str.
3340
3341@@ -91,6 +72,7 @@
3342 return NULL;
3343 }
3344
3345+<<<<<<< TREE
3346 bool IsLastChar (const TCHAR *CharString, const TCHAR Chr)
3347 {
3348 nuxAssert (CharString != 0);
3349@@ -310,6 +292,8 @@
3350 return result;
3351 }
3352
3353+=======
3354+>>>>>>> MERGE-SOURCE
3355 VARARG_BODY (int, Snprintf, const TCHAR *, VARARG_EXTRA (TCHAR *Dest) VARARG_EXTRA (int Size) VARARG_EXTRA (int Count) )
3356 {
3357 int Result = -1;
3358@@ -317,6 +301,7 @@
3359 return Result;
3360 }
3361
3362+<<<<<<< TREE
3363 NString::NString()
3364 {
3365 m_string = TEXT("");
3366@@ -1343,4 +1328,6 @@
3367 return ResultString;
3368 }
3369
3370+=======
3371+>>>>>>> MERGE-SOURCE
3372 }
3373
3374=== modified file 'NuxCore/TextString.h'
3375--- NuxCore/TextString.h 2012-02-18 21:32:06 +0000
3376+++ NuxCore/TextString.h 2012-09-26 05:32:20 +0000
3377@@ -28,8 +28,6 @@
3378 namespace nux
3379 {
3380
3381- class NString;
3382-
3383 class TCharToUpperCase
3384 {
3385 TCHAR *UpperCaseString;
3386@@ -639,240 +637,6 @@
3387
3388 bool IsLastChar (const TCHAR *CharString, const TCHAR Chr);
3389
3390-//
3391-// Convert an integer to a string.
3392-//
3393- NString Itoa ( int InNum );
3394-
3395-
3396-
3397- class NString
3398- {
3399- public:
3400- NString();
3401- NString (const NString &s);
3402- NString (const tstring &s);
3403- NString (const TCHAR &s);
3404- //NString(const TCHAR* s);
3405- NString (const ANSICHAR *s);
3406- NString (const UNICHAR *s);
3407-
3408- ~NString();
3409- NString &operator= (const NString &s);
3410-
3411- const tstring &GetTStringRef() const;
3412- //const TCHAR* GetTChar() const;
3413- const TCHAR *GetTCharPtr() const;
3414-
3415- size_t Length() const;
3416- size_t Size() const;
3417- void Clear();
3418- bool IsEmpty() const;
3419-
3420- void Erase (size_t Pos, size_t count);
3421- NString &Insert (size_t Pos, const TCHAR *Ptr);
3422- NString &Insert (size_t Pos, const TCHAR *Ptr, size_t Count);
3423- NString &Insert (size_t Pos, const tstring &Str);
3424- NString &Insert (size_t Pos, const tstring &Str, size_t Offset, size_t Count);
3425- NString &Insert (size_t Pos, const NString &Str);
3426- NString &Insert (size_t Pos, const NString &Str, size_t Offset, size_t Count);
3427- NString &Insert (size_t Pos, int Count, const TCHAR &Ch);
3428-
3429- const TCHAR &operator[] (size_t ChPos) const;
3430- TCHAR &operator[] (size_t ChPos);
3431-
3432- NString &Replace (size_t Pos1, size_t Num1, const TCHAR *Ptr);
3433- NString &Replace (size_t Pos1, size_t Num1, const TCHAR *Ptr, size_t Num2);
3434- NString &Replace (size_t Pos1, size_t Num1, const tstring &Str);
3435- NString &Replace (size_t Pos1, size_t Num1, const tstring &Str, size_t Pos2, size_t Num2);
3436- NString &Replace (size_t Pos1, size_t Num1, const NString &Str);
3437- NString &Replace (size_t Pos1, size_t Num1, const NString &Str, size_t Pos2, size_t Num2);
3438- NString &Replace (size_t Pos1, size_t Num1, size_t Count, TCHAR Ch);
3439-
3440- //! Reverse the string
3441- void Reverse();
3442-
3443- //! Replace character ChOut with ChIn in the string
3444- NString &SearchAndReplace (TCHAR ChOut, TCHAR ChIn);
3445-
3446- //! Return The last position of the substring suffix or -1 if it is not found.
3447- size_t FindLastOccurence (const TCHAR &suffix) const;
3448- //! Return The last position of the substring suffix or -1 if it is not found.
3449- size_t FindLastOccurence (const TCHAR *suffix) const;
3450- //! Return The last position of the substring suffix or -1 if it is not found.
3451- size_t FindLastOccurence (const tstring &suffix) const;
3452- //! Return The last position of the substring suffix or -1 if it is not found.
3453- size_t FindLastOccurence (const NString &suffix) const;
3454-
3455- //! Return the position of the first occurrence of the substring suffix or -1 if it is not found.
3456- size_t FindFirstOccurence (const TCHAR &suffix) const;
3457- //! Return the position of the first occurrence of the substring suffix or -1 if it is not found.
3458- size_t FindFirstOccurence (const TCHAR *suffix) const;
3459- //! Return the position of the first occurrence of the substring suffix or -1 if it is not found.
3460- size_t FindFirstOccurence (const tstring &suffix) const;
3461- //! Return the position of the first occurrence of the substring suffix or -1 if it is not found.
3462- size_t FindFirstOccurence (const NString &suffix) const;
3463-
3464- //! Return the position of the first occurrence of the substring suffix or -1 if it is not found.
3465- size_t FindNextOccurence (const TCHAR &suffix, size_t start = 0) const;
3466- //! Return the position of the first occurrence of the substring suffix or -1 if it is not found.
3467- size_t FindNextOccurence (const TCHAR *suffix, size_t start = 0) const;
3468- //! Return the position of the first occurrence of the substring suffix or -1 if it is not found.
3469- size_t FindNextOccurence (const tstring &suffix, size_t start = 0) const;
3470- //! Return the position of the first occurrence of the substring suffix or -1 if it is not found.
3471- size_t FindNextOccurence (const NString &suffix, size_t start = 0) const;
3472-
3473- //! Return the position of the first occurrence of the substring suffix or -1 if it is not found.
3474- size_t FindFirstOccurenceOf (const TCHAR &str) const;
3475- //! Return the position of the first occurrence of the substring suffix or -1 if it is not found.
3476- size_t FindFirstOccurenceOf (const TCHAR *str) const;
3477- //! Return the position of the first occurrence of the substring suffix or -1 if it is not found.
3478- size_t FindFirstOccurenceOf (const tstring &str) const;
3479- //! Return the position of the first occurrence of the substring suffix or -1 if it is not found.
3480- size_t FindFirstOccurenceOf (const NString &str) const;
3481-
3482- //! Return the position of the last occurrence of the substring suffix or -1 if it is not found.
3483- size_t FindLastOccurenceOf (const TCHAR &str) const;
3484- //! Return the position of the last occurrence of the substring suffix or -1 if it is not found.
3485- size_t FindLastOccurenceOf (const TCHAR *str) const;
3486- //! Return the position of the last occurrence of the substring suffix or -1 if it is not found.
3487- size_t FindLastOccurenceOf (const tstring &str) const;
3488- //! Return the position of the last occurrence of the substring suffix or -1 if it is not found.
3489- size_t FindLastOccurenceOf (const NString &str) const;
3490-
3491- //! Searches this string for the first match of a substring.
3492- size_t Find (NString str, int start = 0);
3493- //! Searches this string for the first match of a character.
3494- size_t Find (TCHAR c, int start = 0);
3495-
3496- //! Return True if the string is terminated by the character 'suffix'
3497- bool IsSuffix (const TCHAR &suffix);
3498- //! Return True if the string is terminated by the character string 'suffix'
3499- bool IsSuffix (const TCHAR *suffix);
3500- //! Return True if the string is terminated by the tstring 'suffix'
3501- bool IsSuffix (const tstring &suffix);
3502- //! Return True if the string is terminated by the NString 'suffix'
3503- bool IsSuffix (const NString &suffix);
3504-
3505- //! Return True if the string start with the character contained in prefix
3506- bool IsPrefix (const TCHAR &prefix);
3507- //! Return True if the string start with the character string contained in prefix
3508- bool IsPrefix (const TCHAR *prefix);
3509- //! Return True if the string start with the tstring contained in prefix
3510- bool IsPrefix (const tstring &prefix);
3511- //! Return True if the string start with the NString contained in prefix
3512- bool IsPrefix (const NString &prefix);
3513-
3514- //! Remove the suffix if it is present
3515- void RemoveSuffix (const TCHAR &suffix);
3516- //! Remove the suffix if it is present
3517- void RemoveSuffix (const TCHAR *suffix);
3518- //! Remove the suffix if it is present
3519- void RemoveSuffix (const tstring &suffix);
3520- //! Remove the suffix if it is present
3521- void RemoveSuffix (const NString &suffix);
3522-
3523- //! Remove the prefix if it is present
3524- void RemovePrefix (const TCHAR &prefix);
3525- //! Remove the prefix if it is present
3526- void RemovePrefix (const TCHAR *prefix);
3527- //! Remove the prefix if it is present
3528- void RemovePrefix (const tstring &prefix);
3529- //! Remove the prefix if it is present
3530- void RemovePrefix (const NString &prefix);
3531-
3532- //! Return an NString of the first count characters.
3533- NString GetSubString (size_t count) const;
3534- //! Return an NString of the first count characters starting at position start.
3535- NString GetSubString (size_t start, size_t count) const;
3536-
3537-
3538- //! Extracts the first N characters..
3539- NString Mid (size_t count) const;
3540- //! Extracts the middle part of a string.
3541- NString Mid (size_t start, size_t count) const;
3542- //! Extracts the left part of a string. At most N characters are extracted.
3543- NString Left (size_t N) const;
3544- //! Extracts the right part of a string. At most N characters are extracted.
3545- NString Right (size_t N) const;
3546-
3547- //! Trims all leading and trailing whitespace characters from the string.
3548- NString Trim() const;
3549- //! Trim the white space characters at the start of this string. Return a trimmed NString.
3550- NString TrimLeft() const;
3551- //! Trim the white space characters at the end of this string. Return a trimmed NString.
3552- NString TrimRight() const;
3553-
3554- //! Trim any of the characters in the argument string. Return a trimmed NString.
3555- NString TrimLeft (NString str) const;
3556- //! Trim any of the characters in the argument string. Return a trimmed NString.
3557- NString TrimRight (NString str) const;
3558-
3559- //! Get first character.
3560- /*!
3561- @return The first character or 0 if the string is empty.
3562- */
3563- TCHAR GetFirstChar() const;
3564-
3565- //! Get last character.
3566- /*!
3567- @return The last character or 0 if the string is empty.
3568- */
3569- TCHAR GetLastChar() const;
3570-
3571- const TCHAR *operator () () const;
3572- const TCHAR *operator * () const;
3573- //operator const TCHAR*() const;
3574-
3575- //! Append a character to this string.
3576- NString &operator += (const TCHAR &sufix);
3577- //! Append a TCHAR* to this string.
3578- NString &operator += (const TCHAR *sufix);
3579- //! Append a tstring to this string.
3580- NString &operator += (const tstring sufix);
3581- //! Append an NString to this string.
3582- NString &operator += (const NString sufix);
3583-
3584-
3585- void SplitAtFirstOccurenceOf (const TCHAR *SplitString, NString &Left, NString &Right);
3586- void SplitAtFirstOccurenceOf (const TCHAR &SplitChar, NString &Left, NString &Right);
3587- void SplitAtFirstOccurenceOf (const NString &SplitString, NString &Left, NString &Right);
3588-
3589- void SplitAtLastOccurenceOf (const TCHAR *SplitString, NString &Left, NString &Right);
3590- void SplitAtLastOccurenceOf (const TCHAR &SplitChar, NString &Left, NString &Right);
3591- void SplitAtLastOccurenceOf (const NString &SplitString, NString &Left, NString &Right);
3592-
3593- void ParseToArray (std::vector<NString>& StringArray, const NString &delimiter);
3594-
3595- friend bool operator!= (const NString &left, const NString &right);
3596- friend bool operator== (const NString &left, const NString &right);
3597- friend bool operator< (const NString &left, const NString &right);
3598- friend bool operator<= (const NString &left, const NString &right);
3599- friend bool operator> (const NString &left, const NString &right);
3600- friend bool operator>= (const NString &left, const NString &right);
3601-
3602-
3603- friend NString operator+ (const NString &left, const NString &right);
3604-
3605- friend NString operator+ (const NString &left, const TCHAR *right);
3606- friend NString operator+ (const NString &left, const TCHAR right);
3607-
3608- friend NString operator+ (const TCHAR *left, const NString &right);
3609- friend NString operator+ (const TCHAR left, const NString &right);
3610-
3611- friend tostream &operator << (tostream &o, const NString &s);
3612-
3613- /*!
3614- Behave like printf. Use an internal buffer of 1024 characters. Do not use this function if you are expecting
3615- the result to be more that 1024-1 characters.
3616- @return A string with formated arguments in a NString.
3617- */
3618- VARARG_DECL ( static NString, static NString, return, Printf, VARARG_NONE, const TCHAR *, VARARG_NONE, VARARG_NONE );
3619-
3620- public:
3621- tstring m_string;
3622- };
3623-
3624 }
3625
3626 #endif // TEXTSTRING_H
3627
3628=== modified file 'NuxCore/TimeFunctions.cpp'
3629--- NuxCore/TimeFunctions.cpp 2011-10-21 22:06:35 +0000
3630+++ NuxCore/TimeFunctions.cpp 2012-09-26 05:32:20 +0000
3631@@ -127,7 +127,7 @@
3632 }
3633
3634
3635- NString GetFormattedLocalTime()
3636+ std::string GetFormattedLocalTime()
3637 {
3638 TCHAR buffer[1024];
3639 Memset(buffer, 0, 1024);
3640@@ -143,10 +143,10 @@
3641 GetLocalTime (Year, Month, Day, Hour, Minute, Second, MicroSec);
3642 #ifdef _WIN32
3643 _stprintf_s (buffer, 1024 - 1, TEXT ("%d:%d:%d: %d/%d/%d"), Hour, Minute, Second, Day, Month, Year);
3644- NString result = buffer;
3645+ std::string result = buffer;
3646 #else
3647 _stprintf (buffer, TEXT ("%d:%d:%d: %d/%d/%d"), Hour, Minute, Second, Day, Month, Year);
3648- NString result = buffer;
3649+ std::string result = buffer;
3650 #endif
3651
3652 return result;
3653
3654=== modified file 'NuxCore/TimeFunctions.h'
3655--- NuxCore/TimeFunctions.h 2011-10-21 22:06:35 +0000
3656+++ NuxCore/TimeFunctions.h 2012-09-26 05:32:20 +0000
3657@@ -95,7 +95,7 @@
3658 /*!
3659 @return The time formatted in a string.
3660 */
3661- NString GetFormattedLocalTime();
3662+ std::string GetFormattedLocalTime();
3663
3664 /*!
3665 Suspend thread execution for an interval measured in microseconds.
3666
3667=== modified file 'NuxGraphics/FontTexture.cpp'
3668--- NuxGraphics/FontTexture.cpp 2012-07-30 21:49:44 +0000
3669+++ NuxGraphics/FontTexture.cpp 2012-09-26 05:32:20 +0000
3670@@ -36,10 +36,10 @@
3671 FontTexture::FontTexture(const char *FontFile, NUX_FILE_LINE_DECL)
3672 : Object(true, NUX_FILE_LINE_PARAM)
3673 {
3674- NString FontPath = GNuxGraphicsResources.FindResourceLocation(FontFile);
3675+ std::string FontPath = GNuxGraphicsResources.FindResourceLocation(FontFile);
3676
3677 std::filebuf fb;
3678- fb.open(FontPath.GetTCharPtr(), std::ios::in);
3679+ fb.open(FontPath.c_str(), std::ios::in);
3680 std::istream is(&fb);
3681
3682 BMFontParseFNT(is);
3683@@ -72,7 +72,7 @@
3684 return m_Charset.Chars[ascii].XAdvance;
3685 }
3686
3687- int FontTexture::GetStringWidth(const NString &str) const
3688+ int FontTexture::GetStringWidth(const std::string &str) const
3689 {
3690 // unsigned int total = 0;
3691 // for (unsigned int i = 0; i != (unsigned int)str.size(); ++i)
3692@@ -80,12 +80,12 @@
3693 // total += GetCharWidth(str[i]);
3694 // }
3695 // return total;
3696- return GetCharStringWidth(str.GetTCharPtr());
3697+ return GetCharStringWidth(str.c_str());
3698 }
3699
3700 int FontTexture::GetCharStringWidth(const char *str) const
3701 {
3702- if ((str == 0) || (NString(str) == NString("")))
3703+ if (str == 0 || *str == '\0')
3704 return 0;
3705
3706 unsigned int total = 0;
3707@@ -101,14 +101,14 @@
3708 return total;
3709 }
3710
3711- int FontTexture::GetStringWidth(const NString &str, int num_char_to_compute) const
3712+ int FontTexture::GetStringWidth(const std::string &str, int num_char_to_compute) const
3713 {
3714- return GetCharStringWidth(str.GetTCharPtr(), num_char_to_compute);
3715+ return GetCharStringWidth(str.c_str(), num_char_to_compute);
3716 }
3717
3718 int FontTexture::GetCharStringWidth(const char *str, int num_char_to_compute) const
3719 {
3720- if ((str == 0) || (NString(str) == NString("")))
3721+ if (str == 0 || *str == '\0')
3722 return 0;
3723
3724 int num_chars = num_char_to_compute;
3725@@ -215,11 +215,7 @@
3726 // FontPath.AddSearchPath(".");
3727 // FontPath.AddSearchPath("../Fonts");
3728
3729-#ifdef UNICODE
3730- NString font_texture_file = GNuxGraphicsResources.FindResourceLocation(texture);
3731-#else
3732- NString font_texture_file = GNuxGraphicsResources.FindResourceLocation(texture);
3733-#endif
3734+ std::string font_texture_file = GNuxGraphicsResources.FindResourceLocation(texture);
3735
3736 #ifdef NUX_OPENGLES_20
3737 Texture2D *Texture = new Texture2D(NUX_TRACKER_LOCATION);
3738@@ -227,7 +223,7 @@
3739 TextureRectangle *Texture = new TextureRectangle(NUX_TRACKER_LOCATION);
3740 #endif
3741
3742- NBitmapData* bitmap_data = LoadImageFile(font_texture_file.GetTCharPtr());
3743+ NBitmapData* bitmap_data = LoadImageFile(font_texture_file.c_str());
3744
3745 if (bitmap_data)
3746 Texture->Update(bitmap_data, false);
3747@@ -258,12 +254,12 @@
3748 // If the function succeeds, it returns S_OK.
3749 // If the function fails, it returns an HRESULT.
3750 // The return value can be tested with the SUCCEEDED and FAILED macros.
3751- bool FontTexture::CursorPosToX(const NString &Str,
3752+ bool FontTexture::CursorPosToX(const std::string &Str,
3753 int icp,
3754 bool fTrailing,
3755 int *pX)
3756 {
3757- if (icp > (int) Str.Size())
3758+ if (icp > (int) Str.size())
3759 return false;
3760
3761 if (fTrailing)
3762@@ -293,14 +289,14 @@
3763 // If the function is successful, it returns S_OK.
3764 // If the function fails, it returns an HRESULT.
3765 // The return value can be tested with the SUCCEEDED and FAILED macros.
3766- bool FontTexture::XToCursorPosition(const NString &Str,
3767+ bool FontTexture::XToCursorPosition(const std::string &Str,
3768 int iX,
3769 unsigned int FirstVisibleCharIndex,
3770 int *piCh,
3771 int *piTrailing)
3772 {
3773 unsigned int num_chars;
3774- num_chars = (unsigned int) Str.Size();
3775+ num_chars = (unsigned int) Str.size();
3776 nuxAssert(FirstVisibleCharIndex < num_chars);
3777
3778 *piCh = 0;
3779
3780=== modified file 'NuxGraphics/FontTexture.h'
3781--- NuxGraphics/FontTexture.h 2012-02-18 21:32:06 +0000
3782+++ NuxGraphics/FontTexture.h 2012-09-26 05:32:20 +0000
3783@@ -190,9 +190,9 @@
3784 // Knowing the width of a character or a string can be useful if you
3785 // want your UI to look good at all.
3786 int GetCharWidth(const char &c) const;
3787- int GetStringWidth(const NString &str) const;
3788+ int GetStringWidth(const std::string &str) const;
3789 int GetCharStringWidth(const char *str) const;
3790- int GetStringWidth(const NString &str, int num_char_to_compute) const;
3791+ int GetStringWidth(const std::string &str, int num_char_to_compute) const;
3792 int GetCharStringWidth(const char *str, int num_char_to_compute) const;
3793 int GetFontHeight();
3794
3795@@ -211,7 +211,7 @@
3796 // If the function succeeds, it returns S_OK.
3797 // If the function fails, it returns an HRESULT.
3798 // The return value can be tested with the SUCCEEDED and FAILED macros.
3799- bool CursorPosToX(const NString &Str,
3800+ bool CursorPosToX(const std::string &Str,
3801 int icp,
3802 bool fTrailing,
3803 int *pX);
3804@@ -233,7 +233,7 @@
3805 // If the function is successful, it returns S_OK.
3806 // If the function fails, it returns an HRESULT.
3807 // The return value can be tested with the SUCCEEDED and FAILED macros.
3808- bool XToCursorPosition(const NString &Str,
3809+ bool XToCursorPosition(const std::string &Str,
3810 int iX,
3811 unsigned int FirstVisibleCharIndex,
3812 int *piCh,
3813
3814=== modified file 'NuxGraphics/GLSh_ColorPicker.cpp'
3815--- NuxGraphics/GLSh_ColorPicker.cpp 2011-10-19 20:32:38 +0000
3816+++ NuxGraphics/GLSh_ColorPicker.cpp 2012-09-26 05:32:20 +0000
3817@@ -40,7 +40,7 @@
3818 // Use assembly shaders for Intel GPUs: ARB_fragment_program does not have the required
3819 // instruction to implement the HSV to RGB color conversion.
3820
3821- static NString VtxShader = " \n\
3822+ const char* VtxShader = " \n\
3823 uniform mat4 ViewProjectionMatrix; \n\
3824 attribute vec4 AVertex; \n\
3825 attribute vec4 VertexColor; \n\
3826@@ -49,7 +49,7 @@
3827 gl_Position = ViewProjectionMatrix * AVertex; \n\
3828 }";
3829
3830- static NString RedFrgShader = " \n\
3831+ const char* RedFrgShader = " \n\
3832 #ifdef GL_ES \n\
3833 precision mediump float; \n\
3834 #endif \n\
3835@@ -63,7 +63,7 @@
3836 gl_FragColor = vec4(Color.r, y, x, 1.0); \n\
3837 }";
3838
3839- static NString GreenFrgShader = " \n\
3840+ const char* GreenFrgShader = " \n\
3841 #ifdef GL_ES \n\
3842 precision mediump float; \n\
3843 #endif \n\
3844@@ -77,7 +77,7 @@
3845 gl_FragColor = vec4(y, Color.g, x, 1.0); \n\
3846 }";
3847
3848- static NString BlueFrgShader = " \n\
3849+ const char* BlueFrgShader = " \n\
3850 #ifdef GL_ES \n\
3851 precision mediump float; \n\
3852 #endif \n\
3853@@ -91,7 +91,7 @@
3854 gl_FragColor = vec4(x, y, Color.b, 1.0); \n\
3855 }";
3856
3857- static NString HueFrgShader = " \n\
3858+ const char* HueFrgShader = " \n\
3859 #ifdef GL_ES \n\
3860 precision mediump float; \n\
3861 #endif \n\
3862@@ -107,7 +107,7 @@
3863 gl_FragColor = vec4(rgb, 1.0); \n\
3864 }";
3865
3866- static NString SaturationFrgShader = " \n\
3867+ const char* SaturationFrgShader = " \n\
3868 #ifdef GL_ES \n\
3869 precision mediump float; \n\
3870 #endif \n\
3871@@ -123,7 +123,7 @@
3872 gl_FragColor = vec4(rgb, 1.0); \n\
3873 }";
3874
3875- static NString ValueFrgShader = " \n\
3876+ const char* ValueFrgShader = " \n\
3877 #ifdef GL_ES \n\
3878 precision mediump float; \n\
3879 #endif \n\
3880@@ -139,7 +139,7 @@
3881 gl_FragColor = vec4(rgb, 1.0); \n\
3882 }";
3883
3884- static NString HSV_To_RGBFrgShader = " \n\
3885+ const char* HSV_To_RGBFrgShader = " \n\
3886 #ifdef GL_ES \n\
3887 precision mediump float; \n\
3888 #endif \n\
3889@@ -165,7 +165,7 @@
3890
3891 //////////////////////////////////////////////////////////////////////////////
3892
3893- static NString AsmVtxShader = "!!ARBvp1.0 \n\
3894+ const char* AsmVtxShader = "!!ARBvp1.0 \n\
3895 ATTRIB iPos = vertex.position; \n\
3896 PARAM mvp[4] = {state.matrix.mvp}; \n\
3897 OUTPUT oPos = result.position; \n\
3898@@ -176,7 +176,7 @@
3899 DP4 oPos.w, mvp[3], iPos; \n\
3900 END";
3901
3902- NString AsmRedFrgShader = "!!ARBfp1.0 \n\
3903+ const char* AsmRedFrgShader = "!!ARBfp1.0 \n\
3904 PARAM RectPosition = program.local[0]; \n\
3905 PARAM RectDimension = program.local[1]; \n\
3906 PARAM Color = program.local[2]; \n\
3907@@ -193,7 +193,7 @@
3908 MOV result.color, temp1; \n\
3909 END";
3910
3911- NString AsmGreenFrgShader = "!!ARBfp1.0 \n\
3912+ const char* AsmGreenFrgShader = "!!ARBfp1.0 \n\
3913 PARAM RectPosition = program.local[0]; \n\
3914 PARAM RectDimension = program.local[1]; \n\
3915 PARAM Color = program.local[2]; \n\
3916@@ -210,7 +210,7 @@
3917 MOV result.color, temp1; \n\
3918 END";
3919
3920- NString AsmBlueFrgShader = "!!ARBfp1.0 \n\
3921+ const char* AsmBlueFrgShader = "!!ARBfp1.0 \n\
3922 PARAM RectPosition = program.local[0]; \n\
3923 PARAM RectDimension = program.local[1]; \n\
3924 PARAM Color = program.local[2]; \n\
3925@@ -228,15 +228,15 @@
3926 END";
3927
3928
3929- NString AsmHueFrgShader = "!!ARBfp1.0 \n\
3930+ const char* AsmHueFrgShader = "!!ARBfp1.0 \n\
3931 MOV result.color, {0, 0, 0, 0}; \n\
3932 END";
3933
3934- NString AsmSaturationFrgShader = "!!ARBfp1.0 \n\
3935+ const char* AsmSaturationFrgShader = "!!ARBfp1.0 \n\
3936 MOV result.color, {0, 0, 0, 0}; \n\
3937 END";
3938
3939- NString AsmValueFrgShader = "!!ARBfp1.0 \n\
3940+ const char* AsmValueFrgShader = "!!ARBfp1.0 \n\
3941 MOV result.color, {0, 0, 0, 0}; \n\
3942 END";
3943
3944@@ -250,7 +250,7 @@
3945 , _ScreenOffsetX(0)
3946 , _ScreenOffsetY(0)
3947 {
3948- NString FrgShaderCode;
3949+ const char* FrgShaderCode;
3950
3951 if (GetGraphicsDisplay()->GetGraphicsEngine()->UsingGLSLCodePath() && (GetGraphicsDisplay()->GetGpuDevice()->GetGPUBrand() != GPU_BRAND_INTEL))
3952 {
3953@@ -297,11 +297,11 @@
3954 GlobalPixelShader = GetGraphicsDisplay()->GetGpuDevice()->CreatePixelShader();
3955 sprog = GetGraphicsDisplay()->GetGpuDevice()->CreateShaderProgram();
3956
3957- GlobalPixelShader->SetShaderCode(HSV_To_RGBFrgShader.GetTCharPtr());
3958+ GlobalPixelShader->SetShaderCode(HSV_To_RGBFrgShader);
3959
3960 sprog->AddShaderObject(GlobalPixelShader);
3961- sprog->LoadVertexShader(VtxShader.GetTCharPtr(), NULL);
3962- sprog->LoadPixelShader(FrgShaderCode.GetTCharPtr(), NULL);
3963+ sprog->LoadVertexShader(VtxShader, NULL);
3964+ sprog->LoadPixelShader(FrgShaderCode, NULL);
3965 sprog->Link();
3966 }
3967 else
3968@@ -347,8 +347,8 @@
3969 }
3970
3971 m_AsmProg = GetGraphicsDisplay()->GetGpuDevice()->CreateAsmShaderProgram();
3972- m_AsmProg->LoadVertexShader(AsmVtxShader.GetTCharPtr());
3973- m_AsmProg->LoadPixelShader(FrgShaderCode.GetTCharPtr());
3974+ m_AsmProg->LoadVertexShader(AsmVtxShader);
3975+ m_AsmProg->LoadPixelShader(FrgShaderCode);
3976 m_AsmProg->Link();
3977 }
3978 }
3979
3980=== modified file 'NuxGraphics/GLSh_DrawFunction.cpp'
3981--- NuxGraphics/GLSh_DrawFunction.cpp 2011-10-19 20:32:38 +0000
3982+++ NuxGraphics/GLSh_DrawFunction.cpp 2012-09-26 05:32:20 +0000
3983@@ -32,7 +32,7 @@
3984 namespace nux
3985 {
3986
3987- static NString VtxShader = " \n\
3988+ static std::string VtxShader = " \n\
3989 uniform mat4 ViewProjectionMatrix; \n\
3990 attribute vec4 AVertex; \n\
3991 attribute vec4 VertexColor; \n\
3992@@ -41,7 +41,7 @@
3993 gl_Position = ViewProjectionMatrix * AVertex; \n\
3994 }";
3995
3996- static NString FrgShader = " \n\
3997+ static std::string FrgShader = " \n\
3998 #ifdef GL_ES \n\
3999 precision mediump float; \n\
4000 #endif \n\
4001@@ -68,7 +68,7 @@
4002 }";
4003
4004
4005- static NString AsmVtxShader = "!!ARBvp1.0 \n\
4006+ static std::string AsmVtxShader = "!!ARBvp1.0 \n\
4007 ATTRIB iPos = vertex.position; \n\
4008 PARAM mvp[4] = {state.matrix.mvp}; \n\
4009 OUTPUT oPos = result.position; \n\
4010@@ -79,7 +79,7 @@
4011 DP4 oPos.w, mvp[3], iPos; \n\
4012 END";
4013
4014- NString AsmFrgShader = "!!ARBfp1.0 \n\
4015+ std::string AsmFrgShader = "!!ARBfp1.0 \n\
4016 PARAM RectPosition = program.local[0]; \n\
4017 PARAM RectDimension = program.local[1]; \n\
4018 PARAM Color = program.local[2]; \n\
4019@@ -105,15 +105,15 @@
4020 if (GetGraphicsDisplay()->GetGraphicsEngine()->UsingGLSLCodePath() && (GetGraphicsDisplay()->GetGpuDevice()->GetGPUBrand() != GPU_BRAND_INTEL))
4021 {
4022 sprog = GetGraphicsDisplay()->GetGpuDevice()->CreateShaderProgram();
4023- sprog->LoadVertexShader(VtxShader.GetTCharPtr(), NULL);
4024- sprog->LoadPixelShader(FrgShader.GetTCharPtr(), NULL);
4025+ sprog->LoadVertexShader(VtxShader.c_str(), NULL);
4026+ sprog->LoadPixelShader(FrgShader.c_str(), NULL);
4027 sprog->Link();
4028 }
4029 else
4030 {
4031 m_AsmProg = GetGraphicsDisplay()->GetGpuDevice()->CreateAsmShaderProgram();
4032- m_AsmProg->LoadVertexShader(AsmVtxShader.GetTCharPtr());
4033- m_AsmProg->LoadPixelShader(AsmFrgShader.GetTCharPtr());
4034+ m_AsmProg->LoadVertexShader(AsmVtxShader.c_str());
4035+ m_AsmProg->LoadPixelShader(AsmFrgShader.c_str());
4036 m_AsmProg->Link();
4037 }
4038 }
4039
4040=== modified file 'NuxGraphics/GLShaderParameter.h'
4041--- NuxGraphics/GLShaderParameter.h 2011-10-19 20:32:38 +0000
4042+++ NuxGraphics/GLShaderParameter.h 2012-09-26 05:32:20 +0000
4043@@ -51,7 +51,7 @@
4044 public:
4045 int m_Index; // Register m_Index / Attribute m_Index
4046 eShaderParameterType m_ShaderParameterType;
4047- NString m_Name;
4048+ std::string m_Name;
4049 bool m_bIsOptional;
4050 bool m_bIsStatic;
4051 bool bStaticSet;
4052
4053=== modified file 'NuxGraphics/GpuDevice.cpp'
4054--- NuxGraphics/GpuDevice.cpp 2012-09-19 04:53:45 +0000
4055+++ NuxGraphics/GpuDevice.cpp 2012-09-26 05:32:20 +0000
4056@@ -32,6 +32,11 @@
4057 #include "GLTemplatePrimitiveBuffer.h"
4058 #include "GraphicsEngine.h"
4059
4060+#include <boost/algorithm/string/split.hpp>
4061+#include <boost/algorithm/string/classification.hpp>
4062+#include <boost/algorithm/string/case_conv.hpp>
4063+#include <vector>
4064+
4065 namespace nux
4066 {
4067 #if (NUX_ENABLE_CG_SHADERS)
4068@@ -331,13 +336,11 @@
4069 _glsl_version_string = ANSI_TO_TCHAR(NUX_REINTERPRET_CAST(const char *, glGetString(GL_VERSION)));
4070 CHECKGL_MSG(glGetString(GL_VERSION));
4071
4072- NString opengl_major;
4073- NString opengl_minor;
4074- char split = '.';
4075- _glsl_version_string.SplitAtFirstOccurenceOf(split, opengl_major, opengl_minor);
4076+ std::vector<std::string> versions;
4077+ boost::split(versions, _glsl_version_string, boost::algorithm::is_any_of("."));
4078
4079- _opengl_major = (char)opengl_major.GetTCharPtr()[0] - '0';
4080- _opengl_minor = (char)opengl_minor.GetTCharPtr()[0] - '0';
4081+ _opengl_major = std::stoi(versions[0]);
4082+ _opengl_minor = std::stoi(versions[1]);
4083
4084 if (_opengl_major >= 3)
4085 {
4086@@ -528,24 +531,24 @@
4087 _openGL_version_string = ANSI_TO_TCHAR(NUX_REINTERPRET_CAST(const char *, glGetString(GL_VERSION)));
4088 CHECKGL_MSG(glGetString(GL_VERSION));
4089
4090- nuxDebugMsg("Gpu Vendor: %s", _board_vendor_string.GetTCharPtr());
4091- nuxDebugMsg("Gpu Renderer: %s", _board_renderer_string.GetTCharPtr());
4092- nuxDebugMsg("Gpu OpenGL Version: %s", _openGL_version_string.GetTCharPtr());
4093+ nuxDebugMsg("Gpu Vendor: %s", _board_vendor_string.c_str());
4094+ nuxDebugMsg("Gpu Renderer: %s", _board_renderer_string.c_str());
4095+ nuxDebugMsg("Gpu OpenGL Version: %s", _openGL_version_string.c_str());
4096 nuxDebugMsg("Gpu OpenGL Major Version: %d", _opengl_major);
4097 nuxDebugMsg("Gpu OpenGL Minor Version: %d", _opengl_minor);
4098- nuxDebugMsg("Gpu GLSL Version: %s", _glsl_version_string.GetTCharPtr());
4099-
4100- NString TempStr = (const char *) TCharToUpperCase(_board_vendor_string.GetTCharPtr());
4101-
4102- if (TempStr.FindFirstOccurence("NVIDIA") != tstring::npos)
4103+ nuxDebugMsg("Gpu GLSL Version: %s", _glsl_version_string.c_str());
4104+
4105+ std::string TempStr = boost::algorithm::to_upper_copy(_board_vendor_string);
4106+
4107+ if (TempStr.find("NVIDIA", 0) != std::string::npos)
4108 {
4109 _gpu_brand = GPU_BRAND_NVIDIA;
4110 }
4111- else if (TempStr.FindFirstOccurence("ATI") != tstring::npos)
4112+ else if (TempStr.find("ATI", 0) != std::string::npos)
4113 {
4114 _gpu_brand = GPU_BRAND_AMD;
4115 }
4116- else if (TempStr.FindFirstOccurence("TUNGSTEN") != tstring::npos)
4117+ else if (TempStr.find("TUNGSTEN", 0) != std::string::npos)
4118 {
4119 _gpu_brand = GPU_BRAND_INTEL;
4120 }
4121
4122=== modified file 'NuxGraphics/GpuDevice.h'
4123--- NuxGraphics/GpuDevice.h 2012-09-17 09:55:43 +0000
4124+++ NuxGraphics/GpuDevice.h 2012-09-26 05:32:20 +0000
4125@@ -481,10 +481,10 @@
4126 int _glsl_version_major; //!< GLSL major version.
4127 int _glsl_version_minor; //!< GLSL major version.
4128
4129- NString _board_vendor_string; //!< GPU vendor sting.
4130- NString _board_renderer_string; //!< GPU renderer sting.
4131- NString _openGL_version_string; //!< OpenGL version string.
4132- NString _glsl_version_string; //!< GLSL version string.
4133+ std::string _board_vendor_string; //!< GPU vendor sting.
4134+ std::string _board_renderer_string; //!< GPU renderer sting.
4135+ std::string _openGL_version_string; //!< OpenGL version string.
4136+ std::string _glsl_version_string; //!< GLSL version string.
4137 GpuBrand _gpu_brand; //!< GPU brand.
4138
4139 bool _UsePixelBufferObject;
4140
4141=== modified file 'NuxGraphics/GraphicsDisplayWin.cpp'
4142--- NuxGraphics/GraphicsDisplayWin.cpp 2012-08-14 00:53:12 +0000
4143+++ NuxGraphics/GraphicsDisplayWin.cpp 2012-09-26 05:32:20 +0000
4144@@ -717,7 +717,7 @@
4145
4146 if (!wglMakeCurrent(device_context_, glrc))
4147 {
4148- NString error = inlGetSystemErrorMessage();
4149+ std::string error = inlGetSystemErrorMessage();
4150 DestroyOpenGLWindow();
4151 MessageBox(NULL, "Can't Activate The GL Rendering Context.", "ERROR", MB_OK | MB_ICONERROR);
4152 }
4153
4154=== modified file 'NuxGraphics/GraphicsDisplayX11.cpp'
4155--- NuxGraphics/GraphicsDisplayX11.cpp 2012-09-19 04:53:45 +0000
4156+++ NuxGraphics/GraphicsDisplayX11.cpp 2012-09-26 05:32:20 +0000
4157@@ -113,59 +113,59 @@
4158 inlSetThreadLocalStorage(_TLS_GraphicsDisplay, 0);
4159 }
4160
4161- NString GraphicsDisplay::FindResourceLocation(const char *ResourceFileName, bool ErrorOnFail)
4162+ std::string GraphicsDisplay::FindResourceLocation(const char *ResourceFileName, bool ErrorOnFail)
4163 {
4164- NString path = m_ResourcePathLocation.GetFile(ResourceFileName);
4165+ std::string path = m_ResourcePathLocation.GetFile(ResourceFileName);
4166
4167 if (path == "" && ErrorOnFail)
4168 {
4169 nuxCriticalMsg("[GraphicsDisplay::FindResourceLocation] Failed to locate resource file: %s.", ResourceFileName);
4170- return NString("");
4171+ return "";
4172 }
4173
4174 return path;
4175 }
4176
4177- NString GraphicsDisplay::FindUITextureLocation(const char *ResourceFileName, bool ErrorOnFail)
4178+ std::string GraphicsDisplay::FindUITextureLocation(const char *ResourceFileName, bool ErrorOnFail)
4179 {
4180 FilePath searchpath;
4181 searchpath.AddSearchPath(m_UITextureSearchPath);
4182- NString path = searchpath.GetFile(ResourceFileName);
4183+ std::string path = searchpath.GetFile(ResourceFileName);
4184
4185 if ((path == "") && ErrorOnFail)
4186 {
4187 nuxCriticalMsg("[GraphicsDisplay::FindResourceLocation] Failed to locate ui texture file: %s.", ResourceFileName);
4188- return NString("");
4189+ return std::string("");
4190 }
4191
4192 return path;
4193 }
4194
4195- NString GraphicsDisplay::FindShaderLocation(const char *ResourceFileName, bool ErrorOnFail)
4196+ std::string GraphicsDisplay::FindShaderLocation(const char *ResourceFileName, bool ErrorOnFail)
4197 {
4198 FilePath searchpath;
4199 searchpath.AddSearchPath(m_ShaderSearchPath);
4200- NString path = searchpath.GetFile(ResourceFileName);
4201+ std::string path = searchpath.GetFile(ResourceFileName);
4202
4203 if ((path == "") && ErrorOnFail)
4204 {
4205 nuxCriticalMsg("[GraphicsDisplay::FindResourceLocation] Failed to locate shader file: %s.", ResourceFileName);
4206- return NString("");
4207+ return std::string("");
4208 }
4209
4210 return path;
4211 }
4212
4213- NString GraphicsDisplay::FindFontLocation(const char *ResourceFileName, bool ErrorOnFail)
4214+ std::string GraphicsDisplay::FindFontLocation(const char *ResourceFileName, bool ErrorOnFail)
4215 {
4216 FilePath searchpath;
4217 searchpath.AddSearchPath(m_FontSearchPath);
4218- NString path = searchpath.GetFile(ResourceFileName);
4219+ std::string path = searchpath.GetFile(ResourceFileName);
4220
4221 if ((path == "") && ErrorOnFail)
4222 {
4223 nuxCriticalMsg("[GraphicsDisplay::FindResourceLocation] Failed to locate font file file: %s.", ResourceFileName);
4224- return NString("");
4225+ return std::string("");
4226 }
4227
4228 return path;
4229
4230=== modified file 'NuxGraphics/GraphicsDisplayX11.h'
4231--- NuxGraphics/GraphicsDisplayX11.h 2012-09-17 09:55:43 +0000
4232+++ NuxGraphics/GraphicsDisplayX11.h 2012-09-26 05:32:20 +0000
4233@@ -118,7 +118,11 @@
4234
4235 char m_WindowClassName[256];
4236 GLuint m_PixelFormat; // Holds The Results After Searching For A Match
4237+<<<<<<< TREE
4238 std::string window_title_;
4239+=======
4240+ std::string m_WindowTitle;
4241+>>>>>>> MERGE-SOURCE
4242
4243 // size, position
4244 Size viewport_size_;
4245@@ -423,28 +427,28 @@
4246 }
4247 #endif
4248
4249- NString FindResourceLocation(const char *ResourceFileName, bool ErrorOnFail = false);
4250- NString FindUITextureLocation(const char *ResourceFileName, bool ErrorOnFail = false);
4251- NString FindShaderLocation(const char *ResourceFileName, bool ErrorOnFail = false);
4252- NString FindFontLocation(const char *ResourceFileName, bool ErrorOnFail = false);
4253+ std::string FindResourceLocation(const char *ResourceFileName, bool ErrorOnFail = false);
4254+ std::string FindUITextureLocation(const char *ResourceFileName, bool ErrorOnFail = false);
4255+ std::string FindShaderLocation(const char *ResourceFileName, bool ErrorOnFail = false);
4256+ std::string FindFontLocation(const char *ResourceFileName, bool ErrorOnFail = false);
4257
4258- const std::vector<NString>& GetFontSearchPath() const
4259+ const std::vector<std::string>& GetFontSearchPath() const
4260 {
4261 return m_FontSearchPath;
4262 }
4263- const std::vector<NString>& GetShaderSearchPath() const
4264+ const std::vector<std::string>& GetShaderSearchPath() const
4265 {
4266 return m_ShaderSearchPath;
4267 }
4268- const std::vector<NString>& GetUITextureSearchPath() const
4269+ const std::vector<std::string>& GetUITextureSearchPath() const
4270 {
4271 return m_UITextureSearchPath;
4272 }
4273
4274 private:
4275- std::vector<NString> m_FontSearchPath;
4276- std::vector<NString> m_ShaderSearchPath;
4277- std::vector<NString> m_UITextureSearchPath;
4278+ std::vector<std::string> m_FontSearchPath;
4279+ std::vector<std::string> m_ShaderSearchPath;
4280+ std::vector<std::string> m_UITextureSearchPath;
4281 FilePath m_ResourcePathLocation;
4282
4283 GraphicsDisplay();
4284
4285=== modified file 'NuxGraphics/GraphicsEngine.cpp'
4286--- NuxGraphics/GraphicsEngine.cpp 2012-09-17 09:55:43 +0000
4287+++ NuxGraphics/GraphicsEngine.cpp 2012-09-26 05:32:20 +0000
4288@@ -271,18 +271,18 @@
4289 (_graphics_display.GetGpuDevice()->GetOpenGLMajorVersion() >= 2))
4290 #endif
4291 {
4292- NString renderer_string = ANSI_TO_TCHAR(NUX_REINTERPRET_CAST(const char* , glGetString(GL_RENDERER)));
4293+ std::string renderer_string = ANSI_TO_TCHAR(NUX_REINTERPRET_CAST(const char* , glGetString(GL_RENDERER)));
4294 CHECKGL_MSG(glGetString(GL_RENDERER));
4295
4296 // Exclude Geforce FX from using GLSL
4297- if (renderer_string.FindFirstOccurence("GeForce FX") != tstring::npos)
4298+ if (renderer_string.find("GeForce FX", 0) != tstring::npos)
4299 {
4300 _use_glsl_shaders = false;
4301 return;
4302 }
4303
4304 // Exclude Geforce FX Go from using GLSL: this case is not needed since it is detected by the one above.
4305- if (renderer_string.FindFirstOccurence("GeForce FX Go") != tstring::npos)
4306+ if (renderer_string.find("GeForce FX Go", 0) != tstring::npos)
4307 {
4308 _use_glsl_shaders = false;
4309 return;
4310@@ -318,7 +318,7 @@
4311 #else
4312 if (_normal_font.IsNull())
4313 {
4314- FontTexture* fnt = new FontTexture(GNuxGraphicsResources.FindResourceLocation("Fonts/nuxfont_size_8.txt", true).GetTCharPtr(), NUX_TRACKER_LOCATION);
4315+ FontTexture* fnt = new FontTexture(GNuxGraphicsResources.FindResourceLocation("Fonts/nuxfont_size_8.txt", true).c_str(), NUX_TRACKER_LOCATION);
4316 _normal_font = ObjectPtr<FontTexture> (fnt);
4317 fnt->UnReference();
4318 }
4319@@ -331,14 +331,14 @@
4320 #if defined(NUX_OS_WINDOWS)
4321 if (_bold_font.IsNull())
4322 {
4323- FontTexture* fnt = new FontTexture(GNuxGraphicsResources.FindResourceLocation("Fonts/Tahoma_size_8_bold.txt", true).GetTCharPtr(), NUX_TRACKER_LOCATION);
4324+ FontTexture* fnt = new FontTexture(GNuxGraphicsResources.FindResourceLocation("Fonts/Tahoma_size_8_bold.txt", true).c_str(), NUX_TRACKER_LOCATION);
4325 _bold_font = ObjectPtr<FontTexture> (fnt);
4326 fnt->UnReference();
4327 }
4328 #else
4329 if (_bold_font.IsNull())
4330 {
4331- FontTexture* fnt = new FontTexture(GNuxGraphicsResources.FindResourceLocation("Fonts/nuxfont_size_8_bold.txt", true).GetTCharPtr(), NUX_TRACKER_LOCATION);
4332+ FontTexture* fnt = new FontTexture(GNuxGraphicsResources.FindResourceLocation("Fonts/nuxfont_size_8_bold.txt", true).c_str(), NUX_TRACKER_LOCATION);
4333 _bold_font = ObjectPtr<FontTexture> (fnt);
4334 fnt->UnReference();
4335 }
4336
4337=== modified file 'NuxGraphics/IOpenGLAsmShader.cpp'
4338--- NuxGraphics/IOpenGLAsmShader.cpp 2012-08-02 16:29:19 +0000
4339+++ NuxGraphics/IOpenGLAsmShader.cpp 2012-09-26 05:32:20 +0000
4340@@ -39,7 +39,7 @@
4341 NUX_IMPLEMENT_OBJECT_TYPE(IOpenGLAsmPixelShader);
4342 NUX_IMPLEMENT_OBJECT_TYPE(IOpenGLAsmShaderProgram);
4343
4344- bool ExtractShaderString3(const NString &ShaderToken, const NString &ShaderSource, NString &RetSource, NString ShaderPreprocessorDefines);
4345+ bool ExtractShaderString3(const std::string &ShaderToken, const std::string &ShaderSource, std::string &RetSource, std::string ShaderPreprocessorDefines);
4346
4347 IOpenGLAsmShader::IOpenGLAsmShader(std::string const& shader_name, GLint shader_type, OpenGLResourceType ResourceType)
4348 : IOpenGLResource(ResourceType)
4349@@ -113,7 +113,7 @@
4350 {
4351 }
4352
4353- IOpenGLAsmShaderProgram::IOpenGLAsmShaderProgram(NString ShaderProgramName)
4354+ IOpenGLAsmShaderProgram::IOpenGLAsmShaderProgram(const char* ShaderProgramName)
4355 : IOpenGLResource(RT_GLSL_SHADERPROGRAM)
4356 , _ShaderProgramName(ShaderProgramName)
4357 {
4358@@ -131,7 +131,7 @@
4359 {
4360 nuxAssertMsg(ShaderFileName, "[IOpenGLAsmShaderProgram::LoadIShaderFile] Invalid shader file name.");
4361 NUX_RETURN_IF_NULL(ShaderFileName);
4362- NString SourceCode;
4363+ std::string SourceCode;
4364 LoadFileToString(SourceCode, ShaderFileName);
4365 LoadIShader(&SourceCode[0]);
4366 }
4367@@ -140,10 +140,10 @@
4368 {
4369 nuxAssertMsg(ShaderCode, "[IOpenGLAsmShaderProgram::LoadIShader] Invalid shader code.");
4370 NUX_RETURN_IF_NULL(ShaderCode);
4371- NString VertexShaderSource;
4372- ExtractShaderString3("[Vertex Shader]", ShaderCode, VertexShaderSource, NString(""));
4373- NString PixelShaderSource;
4374- ExtractShaderString3("[Fragment Shader]", ShaderCode, PixelShaderSource, NString(""));
4375+ std::string VertexShaderSource;
4376+ ExtractShaderString3("[Vertex Shader]", ShaderCode, VertexShaderSource, std::string(""));
4377+ std::string PixelShaderSource;
4378+ ExtractShaderString3("[Fragment Shader]", ShaderCode, PixelShaderSource, std::string(""));
4379
4380 m_AsmVertexProgram->SetShaderCode(&VertexShaderSource[0]);
4381 m_AsmFragmentProgram->SetShaderCode(&PixelShaderSource[0]);
4382
4383=== modified file 'NuxGraphics/IOpenGLAsmShader.h'
4384--- NuxGraphics/IOpenGLAsmShader.h 2012-08-02 16:29:19 +0000
4385+++ NuxGraphics/IOpenGLAsmShader.h 2012-09-26 05:32:20 +0000
4386@@ -121,9 +121,9 @@
4387 void SetFragmentLocalParameter4fvARB (unsigned int index, const float *params);
4388
4389 private:
4390- IOpenGLAsmShaderProgram(NString ShaderProgramName = NString("AsmShaderProgram"));
4391+ IOpenGLAsmShaderProgram(const char* ShaderProgramName = "AsmShaderProgram");
4392 std::vector<ObjectPtr<IOpenGLAsmShader> > ShaderObjectList;
4393- NString _ShaderProgramName;
4394+ std::string _ShaderProgramName;
4395
4396 ObjectPtr<IOpenGLAsmVertexShader> m_AsmVertexProgram;
4397 ObjectPtr<IOpenGLAsmPixelShader> m_AsmFragmentProgram;
4398
4399=== modified file 'NuxGraphics/IOpenGLGLSLShader.cpp'
4400--- NuxGraphics/IOpenGLGLSLShader.cpp 2012-02-23 16:30:14 +0000
4401+++ NuxGraphics/IOpenGLGLSLShader.cpp 2012-09-26 05:32:20 +0000
4402@@ -43,7 +43,7 @@
4403 NUX_IMPLEMENT_OBJECT_TYPE(IOpenGLShaderProgram);
4404
4405
4406- bool ExtractShaderString3(const NString &ShaderToken, const NString &ShaderSource, NString &RetSource, NString ShaderPreprocessorDefines)
4407+ bool ExtractShaderString3(const std::string &ShaderToken, const std::string &ShaderSource, std::string &RetSource, std::string ShaderPreprocessorDefines)
4408 {
4409 size_t lineStart = 0;
4410 size_t lineCount = 1;
4411@@ -57,7 +57,7 @@
4412 {
4413 size_t i;
4414
4415- for (i = 0; i < ShaderSource.Length(); i++)
4416+ for (i = 0; i < ShaderSource.length(); i++)
4417 {
4418 //Check if the starting character '[' (open bracket) is found at the beginning of the line
4419 // i counts the characters in the file. lineStart is equal to i at the beginning of the line.
4420@@ -66,10 +66,10 @@
4421 if (!startTokenFound)
4422 {
4423 //Test for the start token
4424- if (ShaderSource.FindFirstOccurence(ShaderToken) == i)
4425+ if (ShaderSource.find(ShaderToken, 0) == i)
4426 {
4427 // Found the shader token
4428- shaderStringStart = i + ShaderToken.Length();
4429+ shaderStringStart = i + ShaderToken.length();
4430 startTokenFound = true;
4431
4432 //Set what line the shader was found on
4433@@ -104,13 +104,13 @@
4434 }
4435
4436 //Assign the return string
4437- RetSource = ShaderSource.GetSubString(shaderStringStart, i - shaderStringStart);
4438+ RetSource = ShaderSource.substr(shaderStringStart, i - shaderStringStart);
4439
4440 //Add the line directive to the shader source. See the documentation for GLSL #line directive.
4441 // GLSL spec: The #version directive must occur in a shader before anything else, except for comments and white space.
4442- size_t Pos = RetSource.FindFirstOccurence("#version");
4443+ size_t Pos = RetSource.find("#version", 0);
4444
4445- while (RetSource[Pos] != '\n')
4446+ while (Pos != std::string::npos && RetSource[Pos] != '\n')
4447 {
4448 if (RetSource[Pos] == 0)
4449 break;
4450@@ -124,17 +124,19 @@
4451 size_t EndOfLinePosition = 0;
4452 size_t LinePosition = 0;
4453
4454- while ((EndOfLinePosition = RetSource.FindNextOccurence('\n', EndOfLinePosition)) < Pos - 1)
4455+ while ((EndOfLinePosition = RetSource.find('\n', EndOfLinePosition)) < Pos - 1)
4456 {
4457 ++EndOfLinePosition;
4458 ++LinePosition;
4459 }
4460
4461- RetSource.Insert(Pos, NString::Printf("#line %u\n", LinePosition + shaderStartLine));
4462+ std::string s = "#line ";
4463+ s += std::to_string(LinePosition + shaderStartLine) + "\n";
4464+ RetSource.insert(Pos, s);
4465
4466 // Insert the preprocessor definitions before the #line directive
4467- if (ShaderPreprocessorDefines.Length())
4468- RetSource.Insert(Pos, ShaderPreprocessorDefines + NString('\n'));
4469+ if (ShaderPreprocessorDefines.length())
4470+ RetSource.insert(Pos, ShaderPreprocessorDefines + std::string("\n"));
4471
4472 return true;
4473 }
4474@@ -146,26 +148,26 @@
4475 }
4476 }
4477
4478- static void InsertPreProcessorDefinitions(const NString &ShaderSource, NString &RetSource, NString &ShaderPreprocessorDefines)
4479+ static void InsertPreProcessorDefinitions(const std::string &ShaderSource, std::string &RetSource, std::string &ShaderPreprocessorDefines)
4480 {
4481 RetSource = ShaderSource;
4482
4483- if (ShaderPreprocessorDefines.Length() == 0)
4484+ if (ShaderPreprocessorDefines.length() == 0)
4485 return;
4486
4487 // GLSL spec: The #version directive must occur in a shader before anything else, except for comments and white space.
4488- size_t Pos = RetSource.FindFirstOccurence("#version");
4489+ size_t Pos = RetSource.find("#version", 0);
4490
4491 if (Pos != tstring::npos)
4492 {
4493- Pos = RetSource.FindNextOccurence('\n', Pos);
4494+ Pos = RetSource.find('\n', Pos);
4495
4496- if (Pos == tstring::npos)
4497+ if (Pos == std::string::npos)
4498 {
4499 // this is most likely an incorrect shader
4500- Pos = RetSource.Size();
4501- RetSource.Insert(Pos, NString('\n'));
4502- Pos = RetSource.Size();
4503+ Pos = RetSource.size();
4504+ RetSource.insert(Pos, std::string("\n"));
4505+ Pos = RetSource.size();
4506 }
4507 else
4508 {
4509@@ -178,11 +180,11 @@
4510 Pos = 0;
4511 }
4512
4513- if (ShaderPreprocessorDefines.Length())
4514- RetSource.Insert(Pos, ShaderPreprocessorDefines + NString('\n'));
4515+ if (ShaderPreprocessorDefines.length())
4516+ RetSource.insert(Pos, ShaderPreprocessorDefines + std::string("\n"));
4517 }
4518
4519- IOpenGLShader::IOpenGLShader(NString ShaderName, OpenGLResourceType ResourceType)
4520+ IOpenGLShader::IOpenGLShader(std::string ShaderName, OpenGLResourceType ResourceType)
4521 : IOpenGLResource(ResourceType)
4522 , _ShaderName(ShaderName)
4523 {
4524@@ -194,7 +196,7 @@
4525
4526 }
4527
4528- IOpenGLVertexShader::IOpenGLVertexShader(NString ShaderName)
4529+ IOpenGLVertexShader::IOpenGLVertexShader(std::string ShaderName)
4530 : IOpenGLShader(ShaderName, RT_GLSL_VERTEXSHADER)
4531 , m_CompiledAndReady(false)
4532 {
4533@@ -213,8 +215,8 @@
4534 {
4535 nuxAssertMsg(ShaderCode, "[IOpenGLVertexShader::SetShaderCode] Invalid shader code.");
4536 NUX_RETURN_IF_NULL(ShaderCode);
4537- NString ProcessedShaderSource;
4538- NString Defines(VtxShaderPreprocessorDefines);
4539+ std::string ProcessedShaderSource;
4540+ std::string Defines(VtxShaderPreprocessorDefines);
4541 InsertPreProcessorDefinitions(ShaderCode, ProcessedShaderSource, Defines);
4542
4543 m_CompiledAndReady = false;
4544@@ -223,7 +225,7 @@
4545
4546 bool IOpenGLVertexShader::Compile()
4547 {
4548- size_t CodeSize = _ShaderCode.Size();
4549+ size_t CodeSize = _ShaderCode.size();
4550
4551 if (CodeSize == 0)
4552 {
4553@@ -232,7 +234,7 @@
4554
4555 char *ShaderSource = new char[CodeSize+1];
4556 Memset(ShaderSource, 0, CodeSize + 1);
4557- Memcpy(ShaderSource, _ShaderCode.GetTCharPtr(), CodeSize);
4558+ Memcpy(ShaderSource, _ShaderCode.c_str(), CodeSize);
4559
4560 CHECKGL(glShaderSource(_OpenGLID, 1, (const GLcharARB **) &ShaderSource, NULL));
4561 delete [] ShaderSource;
4562@@ -272,7 +274,7 @@
4563 return(m_CompiledAndReady ? true : false);
4564 }
4565
4566- IOpenGLPixelShader::IOpenGLPixelShader(NString ShaderName)
4567+ IOpenGLPixelShader::IOpenGLPixelShader(std::string ShaderName)
4568 : IOpenGLShader(ShaderName, RT_GLSL_PIXELSHADER)
4569 , m_CompiledAndReady(false)
4570
4571@@ -292,8 +294,8 @@
4572 {
4573 nuxAssertMsg(ShaderCode, "[IOpenGLPixelShader::SetShaderCode] Invalid shader code.");
4574 NUX_RETURN_IF_NULL(ShaderCode);
4575- NString ProcessedShaderSource;
4576- NString Defines(FrgShaderPreprocessorDefines);
4577+ std::string ProcessedShaderSource;
4578+ std::string Defines(FrgShaderPreprocessorDefines);
4579 InsertPreProcessorDefinitions(ShaderCode, ProcessedShaderSource, Defines);
4580
4581 m_CompiledAndReady = false;
4582@@ -303,7 +305,7 @@
4583 bool IOpenGLPixelShader::Compile()
4584 {
4585
4586- GLint CodeSize = (GLint) _ShaderCode.Size();
4587+ GLint CodeSize = (GLint) _ShaderCode.size();
4588
4589 if (CodeSize == 0)
4590 {
4591@@ -312,7 +314,7 @@
4592
4593 char *ShaderSource = new char[CodeSize+1];
4594 Memset(ShaderSource, 0, CodeSize + 1);
4595- Memcpy(ShaderSource, _ShaderCode.m_string.c_str(), CodeSize);
4596+ Memcpy(ShaderSource, _ShaderCode.c_str(), CodeSize);
4597 CHECKGL(glShaderSource(_OpenGLID, 1, (const GLcharARB **) &ShaderSource, &CodeSize));
4598 delete [] ShaderSource;
4599
4600@@ -449,7 +451,7 @@
4601 }
4602 #endif
4603
4604- IOpenGLShaderProgram::IOpenGLShaderProgram(NString ShaderProgramName)
4605+ IOpenGLShaderProgram::IOpenGLShaderProgram(std::string ShaderProgramName)
4606 : IOpenGLResource(RT_GLSL_SHADERPROGRAM)
4607 , _FirstParameter(0)
4608 , m_CompiledAndReady(false)
4609@@ -476,7 +478,7 @@
4610 {
4611 nuxAssertMsg(ShaderFileName, "[IOpenGLShaderProgram::LoadIShaderFile] Invalid shader file name.");
4612 NUX_RETURN_IF_NULL(ShaderFileName);
4613- NString SourceCode;
4614+ std::string SourceCode;
4615 LoadFileToString(SourceCode, ShaderFileName);
4616 LoadIShader(&SourceCode[0], VtxShaderPreprocessorDefines, FrgShaderPreprocessorDefines);
4617 }
4618@@ -485,10 +487,10 @@
4619 {
4620 nuxAssertMsg(ShaderCode, "[IOpenGLShaderProgram::LoadIShader] Invalid shader code.");
4621 NUX_RETURN_IF_NULL(ShaderCode);
4622- NString VertexShaderSource;
4623- ExtractShaderString3("[Vertex Shader]", ShaderCode, VertexShaderSource, NString(VtxShaderPreprocessorDefines));
4624- NString PixelShaderSource;
4625- ExtractShaderString3("[Fragment Shader]", ShaderCode, PixelShaderSource, NString(FrgShaderPreprocessorDefines));
4626+ std::string VertexShaderSource;
4627+ ExtractShaderString3("[Vertex Shader]", ShaderCode, VertexShaderSource, std::string(VtxShaderPreprocessorDefines));
4628+ std::string PixelShaderSource;
4629+ ExtractShaderString3("[Fragment Shader]", ShaderCode, PixelShaderSource, std::string(FrgShaderPreprocessorDefines));
4630
4631 ObjectPtr<IOpenGLVertexShader> vs = GetGraphicsDisplay()->GetGpuDevice()->CreateVertexShader(); //new IOpenGLVertexShader;
4632 ObjectPtr<IOpenGLPixelShader> ps = GetGraphicsDisplay()->GetGpuDevice()->CreatePixelShader(); //new IOpenGLPixelShader;
4633@@ -510,8 +512,8 @@
4634 NUX_RETURN_IF_NULL(glslshader);
4635 ObjectPtr<IOpenGLVertexShader> vs = GetGraphicsDisplay()->GetGpuDevice()->CreateVertexShader(); //new IOpenGLVertexShader;
4636
4637- NString ProcessedShaderSource;
4638- NString Defines(VtxShaderPreprocessorDefines);
4639+ std::string ProcessedShaderSource;
4640+ std::string Defines(VtxShaderPreprocessorDefines);
4641 InsertPreProcessorDefinitions(glslshader, ProcessedShaderSource, Defines);
4642
4643 vs->SetShaderCode(glslshader);
4644@@ -525,8 +527,8 @@
4645 NUX_RETURN_IF_NULL(glslshader);
4646 ObjectPtr<IOpenGLPixelShader> ps = GetGraphicsDisplay()->GetGpuDevice()->CreatePixelShader(); //new IOpenGLPixelShader;
4647
4648- NString ProcessedShaderSource;
4649- NString Defines(FrgShaderPreprocessorDefines);
4650+ std::string ProcessedShaderSource;
4651+ std::string Defines(FrgShaderPreprocessorDefines);
4652 InsertPreProcessorDefinitions(glslshader, ProcessedShaderSource, Defines);
4653
4654 ps->SetShaderCode(glslshader);
4655@@ -607,7 +609,7 @@
4656 {
4657 if (ShaderObjectList[i]->Compile() == false)
4658 {
4659- nuxDebugMsg("[IOpenGLShaderProgram::Link] Attached shader %s does not compile with program: %s.", ShaderObjectList[i]->_ShaderName.GetTCharPtr(), _ShaderProgramName.GetTCharPtr());
4660+ nuxDebugMsg("[IOpenGLShaderProgram::Link] Attached shader %s does not compile with program: %s.", ShaderObjectList[i]->_ShaderName.c_str(), _ShaderProgramName.c_str());
4661 }
4662 }
4663
4664@@ -793,13 +795,13 @@
4665
4666 while (m_CompiledAndReady && parameter)
4667 {
4668- int location = glGetUniformLocationARB(_OpenGLID, TCHAR_TO_ANSI(parameter->m_Name.GetTCharPtr()));
4669- CHECKGL_MSG( glGetUniformLocationARB(_OpenGLID, TCHAR_TO_ANSI(parameter->m_Name.GetTCharPtr())));
4670+ int location = glGetUniformLocationARB(_OpenGLID, TCHAR_TO_ANSI(parameter->m_Name.c_str()));
4671+ CHECKGL_MSG( glGetUniformLocationARB(_OpenGLID, TCHAR_TO_ANSI(parameter->m_Name.c_str())));
4672
4673 //nuxDebugMsg("[IOpenGLShaderProgram::CheckUniformLocation] Location index: %d", location);
4674 if (location == -1 && (!parameter->m_bIsOptional))
4675 {
4676- nuxDebugMsg("[IOpenGLShaderProgram::CheckUniformLocation] Couldn't find shader program parameter %s \n", parameter->m_Name.GetTCharPtr());
4677+ nuxDebugMsg("[IOpenGLShaderProgram::CheckUniformLocation] Couldn't find shader program parameter %s \n", parameter->m_Name.c_str());
4678 nuxAssert(0);
4679 }
4680
4681
4682=== modified file 'NuxGraphics/IOpenGLGLSLShader.h'
4683--- NuxGraphics/IOpenGLGLSLShader.h 2011-10-19 20:32:38 +0000
4684+++ NuxGraphics/IOpenGLGLSLShader.h 2012-09-26 05:32:20 +0000
4685@@ -28,19 +28,19 @@
4686
4687 class IOpenGLResource;
4688
4689- bool ExtractShaderString3(const NString &ShaderToken, const NString &ShaderSource, NString &RetSource, NString ShaderPreprocessorDefines = NString(""));
4690+ bool ExtractShaderString3(const std::string &ShaderToken, const std::string &ShaderSource, std::string &RetSource, std::string ShaderPreprocessorDefines = std::string(""));
4691
4692 class IOpenGLShader: public IOpenGLResource
4693 {
4694 NUX_DECLARE_OBJECT_TYPE(IOpenGLShader, IOpenGLResource);
4695- IOpenGLShader(NString ShaderName, OpenGLResourceType ResourceType);
4696+ IOpenGLShader(std::string ShaderName, OpenGLResourceType ResourceType);
4697 virtual ~IOpenGLShader();
4698 public:
4699 virtual void SetShaderCode(const ANSICHAR *ShaderCode, const char *ShaderPreprocessorDefines = "") = 0;
4700 virtual bool Compile() = 0;
4701 virtual bool IsValid() = 0;
4702- NString _ShaderName;
4703- NString _ShaderCode;
4704+ std::string _ShaderName;
4705+ std::string _ShaderCode;
4706 };
4707
4708 class IOpenGLVertexShader: public IOpenGLShader
4709@@ -52,7 +52,7 @@
4710 virtual bool Compile();
4711 virtual bool IsValid();
4712 private:
4713- IOpenGLVertexShader(NString ShaderName = NString("Vertex Shader"));
4714+ IOpenGLVertexShader(std::string ShaderName = std::string("Vertex Shader"));
4715 int m_CompiledAndReady;
4716 friend class GpuDevice;
4717 };
4718@@ -66,7 +66,7 @@
4719 virtual bool Compile();
4720 virtual bool IsValid();
4721 private:
4722- IOpenGLPixelShader(NString ShaderName = NString("Fragment Shader"));
4723+ IOpenGLPixelShader(std::string ShaderName = std::string("Fragment Shader"));
4724 int m_CompiledAndReady;
4725 friend class GpuDevice;
4726 };
4727@@ -207,11 +207,11 @@
4728 int GetAttributeLocation(const char *AttributeName);
4729
4730 private:
4731- IOpenGLShaderProgram(NString ShaderProgramName = NString("ShaderProgram"));
4732+ IOpenGLShaderProgram(std::string ShaderProgramName = std::string("ShaderProgram"));
4733 ShaderAttributeDefinition m_ProgramAttributeDefinition[16/*NUM_VERTEX_SHADER_INPUT_ATTRIBUTE*/];
4734 std::vector<ObjectPtr<IOpenGLShader> > ShaderObjectList;
4735 bool m_CompiledAndReady;
4736- NString _ShaderProgramName;
4737+ std::string _ShaderProgramName;
4738 friend class GpuDevice;
4739 };
4740
4741
4742=== modified file 'NuxGraphics/NuxGraphics.h'
4743--- NuxGraphics/NuxGraphics.h 2011-10-19 20:32:38 +0000
4744+++ NuxGraphics/NuxGraphics.h 2012-09-26 05:32:20 +0000
4745@@ -30,8 +30,8 @@
4746
4747 GraphicsDisplay* GetGraphicsDisplay();
4748
4749- #define NUX_FINDRESOURCELOCATION(a) GNuxGraphicsResources.FindResourceLocation(a, false)()
4750- #define NUX_FIND_RESOURCE_LOCATION_NOFAIL(a) GNuxGraphicsResources.FindResourceLocation(a, true)()
4751+ #define NUX_FINDRESOURCELOCATION(a) GNuxGraphicsResources.FindResourceLocation(a, false)
4752+ #define NUX_FIND_RESOURCE_LOCATION_NOFAIL(a) GNuxGraphicsResources.FindResourceLocation(a, true)
4753
4754 inlDeclareThreadLocalStorage(GraphicsDisplay *, 1, _TLS_GraphicsDisplay);
4755
4756
4757=== modified file 'NuxGraphics/NuxGraphicsResources.cpp'
4758--- NuxGraphics/NuxGraphicsResources.cpp 2011-10-19 20:32:38 +0000
4759+++ NuxGraphics/NuxGraphicsResources.cpp 2012-09-26 05:32:20 +0000
4760@@ -41,83 +41,6 @@
4761
4762 void NuxGraphicsResources::InitializeResources()
4763 {
4764-// FilePath m_FilePath;
4765-// m_FilePath.AddSearchPath(""); // for case where fully qualified path is given
4766-// m_FilePath.AddSearchPath("./ini");
4767-// m_FilePath.AddSearchPath("../ini");
4768-// m_FilePath.AddSearchPath("../../ini");
4769-// m_FilePath.AddSearchPath("../../../ini");
4770-//
4771-//
4772-// NString file_search = "inalogic.ini";
4773-// NString FileName = m_FilePath.GetFile(file_search.GetTCharPtr());
4774-// if (FileName == "")
4775-// {
4776-// nuxCriticalMsg("[GraphicsDisplay::GraphicsDisplay] Can't find inalogic.ini file.");
4777-// // exit(-1);
4778-// }
4779-//
4780-// if (FileName != "")
4781-// {
4782-// NString key_name = "UseBackupFBO";
4783-// NString section_name = "OpenGLSystem";
4784-//
4785-// if (CIniFile::RecordExists(key_name.GetTCharPtr(), section_name.GetTCharPtr(), FileName.GetTCharPtr()) == false)
4786-// {
4787-// nuxDebugMsg("[GraphicsDisplay::GraphicsDisplay] Key [%s] does not exit in .ini file.");
4788-// }
4789-// else
4790-// {
4791-// bool m_BackupFrameBuffer;
4792-// NString value = CIniFile::GetValue(key_name.GetTCharPtr(), section_name.GetTCharPtr(), FileName.GetTCharPtr());
4793-// if ((value == "1") || (value == "true"))
4794-// {
4795-// m_BackupFrameBuffer = true;
4796-// }
4797-// else
4798-// {
4799-// m_BackupFrameBuffer = false;
4800-// }
4801-// }
4802-//
4803-// section_name = "SearchPath";
4804-// key_name = "FontPath";
4805-// if (CIniFile::RecordExists(key_name.GetTCharPtr(), section_name.GetTCharPtr(), FileName.GetTCharPtr()))
4806-// {
4807-// NString FontPath = CIniFile::GetValue(key_name.GetTCharPtr(), section_name.GetTCharPtr(), FileName.GetTCharPtr());
4808-// FontPath.ParseToArray(m_FontSearchPath, ";");
4809-// }
4810-// else
4811-// {
4812-// nuxCriticalMsg("[GraphicsDisplay::GraphicsDisplay] Failed to read font search path from .ini file.");
4813-// // return;
4814-//
4815-// }
4816-//
4817-// key_name = "UITexturePath";
4818-// if (CIniFile::RecordExists(key_name.GetTCharPtr(), section_name.GetTCharPtr(), FileName.GetTCharPtr()))
4819-// {
4820-// NString UITexturePath = CIniFile::GetValue(key_name.GetTCharPtr(), section_name.GetTCharPtr(), FileName.GetTCharPtr());
4821-// UITexturePath.ParseToArray(m_UITextureSearchPath, ";");
4822-// }
4823-// else
4824-// {
4825-// nuxCriticalMsg("[GraphicsDisplay::GraphicsDisplay] Failed to read texture search path from .ini file.");
4826-// // return;
4827-// }
4828-//
4829-// key_name = "ShaderPath";
4830-// if (CIniFile::RecordExists(key_name.GetTCharPtr(), section_name.GetTCharPtr(), FileName.GetTCharPtr()))
4831-// {
4832-// NString ShaderPath = CIniFile::GetValue(key_name.GetTCharPtr(), section_name.GetTCharPtr(), FileName.GetTCharPtr());
4833-// ShaderPath.ParseToArray(m_ShaderSearchPath, ";");
4834-// }
4835-// else
4836-// {
4837-// nuxCriticalMsg("[GraphicsDisplay::GraphicsDisplay] Failed to read shader search path from .ini file.");
4838-// // return;
4839-// }
4840-// }
4841
4842 #ifdef NUX_OS_LINUX
4843 m_ResourcePathLocation.AddSearchPath(PKGDATADIR);
4844@@ -158,117 +81,117 @@
4845 }
4846
4847 #ifdef NUX_OS_WINDOWS
4848- NString NuxGraphicsResources::FindResourceLocation(const char *ResourceFileName, bool ErrorOnFail)
4849+ std::string NuxGraphicsResources::FindResourceLocation(const char *ResourceFileName, bool ErrorOnFail)
4850 {
4851- NString path = m_ResourcePathLocation.GetFile(ResourceFileName);
4852+ std::string path = m_ResourcePathLocation.GetFile(ResourceFileName);
4853
4854 if (path == "" && ErrorOnFail)
4855 {
4856 nuxCriticalMsg("[NuxGraphicsResources::FindResourceLocation] Failed to locate resource file: %s.", ResourceFileName);
4857- return NString("");
4858+ return std::string("");
4859 }
4860
4861 return path;
4862 }
4863
4864- NString NuxGraphicsResources::FindUITextureLocation(const char *ResourceFileName, bool ErrorOnFail)
4865+ std::string NuxGraphicsResources::FindUITextureLocation(const char *ResourceFileName, bool ErrorOnFail)
4866 {
4867 FilePath searchpath;
4868 searchpath.AddSearchPath(m_UITextureSearchPath);
4869- NString path = searchpath.GetFile(ResourceFileName);
4870+ std::string path = searchpath.GetFile(ResourceFileName);
4871
4872 if ((path == "") && ErrorOnFail)
4873 {
4874 nuxCriticalMsg("[NuxGraphicsResources::FindResourceLocation] Failed to locate ui texture file: %s.", ResourceFileName);
4875- return NString("");
4876+ return std::string("");
4877 }
4878
4879 return path;
4880 }
4881
4882- NString NuxGraphicsResources::FindShaderLocation(const char *ResourceFileName, bool ErrorOnFail)
4883+ std::string NuxGraphicsResources::FindShaderLocation(const char *ResourceFileName, bool ErrorOnFail)
4884 {
4885 FilePath searchpath;
4886 searchpath.AddSearchPath(m_ShaderSearchPath);
4887- NString path = searchpath.GetFile(ResourceFileName);
4888+ std::string path = searchpath.GetFile(ResourceFileName);
4889
4890 if ((path == "") && ErrorOnFail)
4891 {
4892 nuxCriticalMsg("[NuxGraphicsResources::FindResourceLocation] Failed to locate shader file: %s.", ResourceFileName);
4893- return NString("");
4894+ return std::string("");
4895 }
4896
4897 return path;
4898 }
4899
4900- NString NuxGraphicsResources::FindFontLocation(const char *ResourceFileName, bool ErrorOnFail)
4901+ std::string NuxGraphicsResources::FindFontLocation(const char *ResourceFileName, bool ErrorOnFail)
4902 {
4903 FilePath searchpath;
4904 searchpath.AddSearchPath(m_FontSearchPath);
4905- NString path = searchpath.GetFile(ResourceFileName);
4906+ std::string path = searchpath.GetFile(ResourceFileName);
4907
4908 if ((path == "") && ErrorOnFail)
4909 {
4910 nuxCriticalMsg("[NuxGraphicsResources::FindResourceLocation] Failed to locate font file file: %s.", ResourceFileName);
4911- return NString("");
4912+ return std::string("");
4913 }
4914
4915 return path;
4916 }
4917 #elif defined(NUX_OS_LINUX)
4918- NString NuxGraphicsResources::FindResourceLocation(const char *ResourceFileName, bool ErrorOnFail)
4919+ std::string NuxGraphicsResources::FindResourceLocation(const char *ResourceFileName, bool ErrorOnFail)
4920 {
4921- NString path = m_ResourcePathLocation.GetFile(ResourceFileName);
4922+ std::string path = m_ResourcePathLocation.GetFile(ResourceFileName);
4923
4924 if (path == "" && ErrorOnFail)
4925 {
4926 nuxCriticalMsg("[NuxGraphicsResources::FindResourceLocation] Failed to locate resource file: %s.", ResourceFileName);
4927- return NString("");
4928+ return "";
4929 }
4930
4931 return path;
4932 }
4933
4934- NString NuxGraphicsResources::FindUITextureLocation(const char *ResourceFileName, bool ErrorOnFail)
4935+ std::string NuxGraphicsResources::FindUITextureLocation(const char *ResourceFileName, bool ErrorOnFail)
4936 {
4937 FilePath searchpath;
4938 searchpath.AddSearchPath(m_UITextureSearchPath);
4939- NString path = searchpath.GetFile(ResourceFileName);
4940+ std::string path = searchpath.GetFile(ResourceFileName);
4941
4942 if ((path == "") && ErrorOnFail)
4943 {
4944 nuxCriticalMsg("[NuxGraphicsResources::FindResourceLocation] Failed to locate ui texture file: %s.", ResourceFileName);
4945- return NString("");
4946+ return std::string("");
4947 }
4948
4949 return path;
4950 }
4951
4952- NString NuxGraphicsResources::FindShaderLocation(const char *ResourceFileName, bool ErrorOnFail)
4953+ std::string NuxGraphicsResources::FindShaderLocation(const char *ResourceFileName, bool ErrorOnFail)
4954 {
4955 FilePath searchpath;
4956 searchpath.AddSearchPath(m_ShaderSearchPath);
4957- NString path = searchpath.GetFile(ResourceFileName);
4958+ std::string path = searchpath.GetFile(ResourceFileName);
4959
4960 if ((path == "") && ErrorOnFail)
4961 {
4962 nuxCriticalMsg("[NuxGraphicsResources::FindResourceLocation] Failed to locate shader file: %s.", ResourceFileName);
4963- return NString("");
4964+ return std::string("");
4965 }
4966
4967 return path;
4968 }
4969
4970- NString NuxGraphicsResources::FindFontLocation(const char *ResourceFileName, bool ErrorOnFail)
4971+ std::string NuxGraphicsResources::FindFontLocation(const char *ResourceFileName, bool ErrorOnFail)
4972 {
4973 FilePath searchpath;
4974 searchpath.AddSearchPath(m_FontSearchPath);
4975- NString path = searchpath.GetFile(ResourceFileName);
4976+ std::string path = searchpath.GetFile(ResourceFileName);
4977
4978 if ((path == "") && ErrorOnFail)
4979 {
4980 nuxCriticalMsg("[NuxGraphicsResources::FindResourceLocation] Failed to locate font file file: %s.", ResourceFileName);
4981- return NString("");
4982+ return std::string("");
4983 }
4984
4985 return path;
4986
4987=== modified file 'NuxGraphics/NuxGraphicsResources.h'
4988--- NuxGraphics/NuxGraphicsResources.h 2011-10-19 20:32:38 +0000
4989+++ NuxGraphics/NuxGraphicsResources.h 2012-09-26 05:32:20 +0000
4990@@ -34,16 +34,16 @@
4991 public:
4992
4993 void InitializeResources();
4994- NString FindResourceLocation(const char *ResourceFileName, bool ErrorOnFail = false);
4995- NString FindUITextureLocation(const char *ResourceFileName, bool ErrorOnFail = false);
4996- NString FindShaderLocation(const char *ResourceFileName, bool ErrorOnFail = false);
4997- NString FindFontLocation(const char *ResourceFileName, bool ErrorOnFail = false);
4998+ std::string FindResourceLocation(const char *ResourceFileName, bool ErrorOnFail = false);
4999+ std::string FindUITextureLocation(const char *ResourceFileName, bool ErrorOnFail = false);
5000+ std::string FindShaderLocation(const char *ResourceFileName, bool ErrorOnFail = false);
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches