diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2013-09-19 02:05:00 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2013-09-19 02:05:00 +0000 |
| commit | f6e99d7d1b76dd7a7933f55ba095bdcb534f81b3 (patch) | |
| tree | cbee5d1eec2e1afe8c3f8033d528cab4504c3c49 /src/svg/itos.cpp | |
| parent | Encapsulate the shared memory hack for Cairo and GdkPixbuf in a class (diff) | |
| parent | Added gpl notice (diff) | |
| download | inkscape-f6e99d7d1b76dd7a7933f55ba095bdcb534f81b3.tar.gz inkscape-f6e99d7d1b76dd7a7933f55ba095bdcb534f81b3.zip | |
Merge C++ification of the SP tree by Markus Engel
(bzr r12532)
Diffstat (limited to 'src/svg/itos.cpp')
| -rw-r--r-- | src/svg/itos.cpp | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/src/svg/itos.cpp b/src/svg/itos.cpp deleted file mode 100644 index 78726d068..000000000 --- a/src/svg/itos.cpp +++ /dev/null @@ -1,81 +0,0 @@ -///////////////////////////////////////////////////////////////////////// -// ftoa.cpp -// -// Copyright (c) 1996-2003 Bryce W. Harrington [bryce at osdl dot org] -// -//----------------------------------------------------------------------- -// License: This code may be used by anyone for any purpose -// so long as the copyright notices and this license -// statement remains attached. -//----------------------------------------------------------------------- -// -// This routine converts an integer into a string -// -///////////////////////////////////////////////////////////////////////// - -// Standard include files -#include <algorithm> -#include <string> // for string -#include <cstring> - -#include "../io/ftos.h" /* own include */ /* note - why in different dirs? */ - -using std::string; - -string itos(int n) -{ - int sign; - string s; - - if ((sign = n) < 0) // record sign - n = -n; // make n positive - do { // generate digits in reverse order - s += (char(n % 10) + '0'); // get next digit - } while ((n/=10) > 0); // delete it - - if (sign < 0) - s += '-'; - - reverse(s.begin(), s.end()); // This is what the code should look like - // if the string class is compatible with - // the standard C++ string class -#ifdef DUMB_OS_LIKE_WINDOWS - // In Windows, we'll use this hack... - for (int i=0, j=s.GetLength()-1; i<j; i++, j--) - { - char c = s[i]; -// s[i] = s[j]; -// s[j] = c; - s.SetAt(i, s[j]); - s.SetAt(j, c); - } -#endif - - return s; -} - -string ultos(unsigned long n) -{ - string s; - - do { // generate digits in reverse order - s += (char(n % 10) + '0'); // get next digit - } while ((n/=10) > 0); // delete it - - reverse(s.begin(), s.end()); // This is what the code should look like - // if the string class is compatible with - // the standard C++ string class -#ifdef DUMB_OS_LIKE_WINDOWS - // In Windows, we'll use this hack... - for (int i=0, j=s.GetLength()-1; i<j; i++, j--) - { - char c = s[i]; -// s[i] = s[j]; -// s[j] = c; - s.SetAt(i, s[j]); - s.SetAt(j, c); - } -#endif - - return s; -} |
