Changeset 92 for cpp/gdk


Ignore:
Timestamp:
07/02/13 22:31:23 (11 years ago)
Author:
Maciej Komosinski
Message:

SString::valueOf(value) can handle more argument types

Location:
cpp/gdk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpp/gdk/extvalue.cpp

    r82 r92  
    77#include <math.h>
    88
    9 SString ExtObject::toString()
     9SString ExtObject::toString() const
    1010{
    1111if (isEmpty()) return SString("<empty object>");
  • cpp/gdk/extvalue.h

    r66 r92  
    5959int operator==(const ExtObject& src) {if (object!=src.object) return 0; return (object==0)?(param==src.param):1;}
    6060
    61 SString toString();
     61SString toString() const;
    6262
    6363ExtObject(Param *p,void *o):subtype(2),object(o),param(p){}
  • cpp/gdk/sstring.cpp

    r81 r92  
    66#include "sstring.h"
    77#include "nonstd_stl.h"
    8 
     8#include "extvalue.h"
    99
    1010static int guessMemSize(int request, int memhint)
     
    312312return t;
    313313}
     314const SString& SString::valueOf(long i)
     315{
     316static SString t;
     317sprintf(t.directWrite(20),"%d",i); t.endWrite();
     318return t;
     319}
    314320const SString& SString::valueOf(double d)
    315321{
     
    318324return t;
    319325}
     326const SString& SString::valueOf(const SString& s)
     327{
     328return s;
     329}
     330SString SString::valueOf(const ExtValue& v)
     331{
     332return v.getString();
     333}
     334SString SString::valueOf(const ExtObject& v)
     335{
     336return v.toString();
     337}
    320338
    321339SString &SString::empty()
  • cpp/gdk/sstring.h

    r81 r92  
    99#include <stdlib.h>
    1010#include <stdio.h>
     11
     12class ExtValue;  //this include would result in recurrent inclusion: #include "extvalue.h"
     13class ExtObject;
    1114
    1215class SBuf
     
    155158
    156159static const SString& valueOf(int);
     160static const SString& valueOf(long);
    157161static const SString& valueOf(double);
     162static const SString& valueOf(const SString&); //tylko do kompletu zeby mozna uzyc tej funkcji nie martwiac sie o typ argumentu
     163static SString valueOf(const ExtValue&); //tylko do kompletu zeby mozna uzyc tej funkcji nie martwiac sie o typ argumentu
     164static SString valueOf(const ExtObject&); //tylko do kompletu zeby mozna uzyc tej funkcji nie martwiac sie o typ argumentu
    158165
    159166static SString &empty();
Note: See TracChangeset for help on using the changeset viewer.