~ubuntu-branches/ubuntu/jaunty/ecasound2.2/jaunty

« back to all changes in this revision

Viewing changes to kvutils/kvu_message_item.h

  • Committer: Bazaar Package Importer
  • Author(s): Junichi Uekawa
  • Date: 2005-04-14 09:15:48 UTC
  • Revision ID: james.westby@ubuntu.com-20050414091548-o7kgb47z0tcunh0s
Tags: upstream-2.4.1
ImportĀ upstreamĀ versionĀ 2.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- mode: C++; -*-
 
2
#ifndef INCLUDED_KVU_MESSAGE_ITEM_H
 
3
#define INCLUDED_KVU_MESSAGE_ITEM_H
 
4
 
 
5
#include <string>
 
6
 
 
7
/**
 
8
 * A simple version of C++ stringstream
 
9
 */
 
10
class MESSAGE_ITEM {
 
11
  
 
12
  std::string stringtemp;
 
13
  int flo_prec;
 
14
 
 
15
public:
 
16
 
 
17
    MESSAGE_ITEM(void) { flo_prec = 2; }
 
18
 
 
19
    void setprecision (int prec) { flo_prec = prec; }
 
20
    const std::string& to_string(void) const { return(stringtemp); }
 
21
 
 
22
    MESSAGE_ITEM& operator<< (std::string& c) { stringtemp = stringtemp + c; return (*this); }
 
23
    MESSAGE_ITEM& operator<< (const std::string& c) { stringtemp = stringtemp + c; return (*this); }
 
24
    MESSAGE_ITEM& operator<< (char c);
 
25
    MESSAGE_ITEM& operator<< (unsigned char c) { return (*this) << (char)c; }
 
26
    MESSAGE_ITEM& operator<< (signed char c) { return (*this) << (char)c; }
 
27
    MESSAGE_ITEM& operator<< (const char *s) { stringtemp = stringtemp + std::string(s); return (*this); }
 
28
    MESSAGE_ITEM& operator<< (const unsigned char *s)
 
29
        { return (*this) << (const char*)s; }
 
30
    MESSAGE_ITEM& operator<< (const signed char *s)
 
31
        { return (*this) << (const char*)s; }
 
32
    MESSAGE_ITEM& operator<< (const void *p);
 
33
    MESSAGE_ITEM& operator<< (int n);
 
34
    MESSAGE_ITEM& operator<< (unsigned int n);
 
35
    MESSAGE_ITEM& operator<< (long int n);
 
36
    MESSAGE_ITEM& operator<< (unsigned long n);
 
37
 
 
38
#if defined _ISOC99_SOURCE || defined _ISOC9X_SOURCE || defined _LARGEFILE_SOURCE || defined __GNUC__
 
39
    MESSAGE_ITEM& operator<< (long long int n);
 
40
    MESSAGE_ITEM& operator<< (unsigned long long int n);
 
41
#endif
 
42
 
 
43
    MESSAGE_ITEM& operator<< (short n) {return operator<<((int)n);}
 
44
    MESSAGE_ITEM& operator<< (unsigned short n) {return operator<<((unsigned int)n);}
 
45
    MESSAGE_ITEM& operator<< (bool b) { return operator<<((int)b); }
 
46
    MESSAGE_ITEM& operator<< (double n);
 
47
    MESSAGE_ITEM& operator<< (float n) { return operator<<((double)n); }
 
48
};
 
49
 
 
50
#endif