# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlCore/Say.hpp

Go to the documentation of this file.

    00001 /**************************************************************************************/
    00002 /*                                                                                    */
    00003 /*  Visualization Library                                                             */
    00004 /*  http://www.visualizationlibrary.com                                               */
    00005 /*                                                                                    */
    00006 /*  Copyright (c) 2005-2010, Michele Bosi                                             */
    00007 /*  All rights reserved.                                                              */
    00008 /*                                                                                    */
    00009 /*  Redistribution and use in source and binary forms, with or without modification,  */
    00010 /*  are permitted provided that the following conditions are met:                     */
    00011 /*                                                                                    */
    00012 /*  - Redistributions of source code must retain the above copyright notice, this     */
    00013 /*  list of conditions and the following disclaimer.                                  */
    00014 /*                                                                                    */
    00015 /*  - Redistributions in binary form must reproduce the above copyright notice, this  */
    00016 /*  list of conditions and the following disclaimer in the documentation and/or       */
    00017 /*  other materials provided with the distribution.                                   */
    00018 /*                                                                                    */
    00019 /*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND   */
    00020 /*  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED     */
    00021 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE            */
    00022 /*  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR  */
    00023 /*  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    */
    00024 /*  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;      */
    00025 /*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON    */
    00026 /*  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT           */
    00027 /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS     */
    00028 /*  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                      */
    00029 /*                                                                                    */
    00030 /**************************************************************************************/
    00031
    00032 #ifndef Say_INCLUDE_ONCE
    00033 #define Say_INCLUDE_ONCE
    00034
    00035 #include <vlCore/String.hpp>
    00036 #include <string>
    00037
    00038 namespace vl
    00039 {
    00040   //-----------------------------------------------------------------------------
    00041   // SayArg
    00042   //-----------------------------------------------------------------------------
    00044   class VLCORE_EXPORT SayArg
    00045   {
    00046   friend class Say;
    00047   public:
    00048     SayArg();
    00049
    00050     explicit SayArg(const unsigned char* d);
    00051
    00052     explicit SayArg(const std::string& d);
    00053
    00054     explicit SayArg(const char* d);
    00055
    00056     explicit SayArg(void* d);
    00057
    00058     explicit SayArg(const String& d);
    00059
    00060     explicit SayArg(double d);
    00061
    00062     explicit SayArg(float d);
    00063
    00064     explicit SayArg(unsigned char d);
    00065
    00066     explicit SayArg(signed char d);
    00067
    00068     explicit SayArg(unsigned short d);
    00069
    00070     explicit SayArg(signed short d);
    00071
    00072     explicit SayArg(unsigned int d);
    00073
    00074     explicit SayArg(signed int d);
    00075
    00076     explicit SayArg(unsigned long d);
    00077
    00078     explicit SayArg(signed long d);
    00079
    00080     explicit SayArg(unsigned long long d);
    00081
    00082     explicit SayArg(signed long long d);
    00083
    00084   protected:
    00085     void init();
    00086
    00087     String str;
    00088     double float64;
    00089     unsigned long long ulonglong;
    00090     signed   long long slonglong;
    00091
    00092     enum
    00093     {
    00094       NO_TYPE,
    00095       STRING,
    00096       FLOAT64,
    00097       ULONGLONG,
    00098       SLONGLONG
    00099     } type;
    00100
    00101   };
    00102   //-----------------------------------------------------------------------------
    00103   // Say
    00104   //-----------------------------------------------------------------------------
    00124   class VLCORE_EXPORT Say: public std::vector<SayArg>
    00125   {
    00126   public:
    00127     String format_string;
    00128
    00129     Say(const String& fstr)
    00130     {
    00131       format_string = fstr;
    00132     }
    00133
    00134     Say& operator<<(const SayArg& p)
    00135     {
    00136       push_back(p);
    00137       return *this;
    00138     }
    00139
    00140     template <typename T>
    00141     Say& operator<<(T p)
    00142     {
    00143       push_back(SayArg(p));
    00144       return *this;
    00145     }
    00146
    00147     operator String()
    00148     {
    00149       return parse(*this);
    00150     }
    00151
    00152     String str() const
    00153     {
    00154       return parse(*this);
    00155     }
    00156
    00157   protected:
    00158     String parse( const Say& pset ) const;
    00159
    00160     String euronotation(const String& str, int base) const;
    00161
    00162     String format(unsigned long long n, int base, int field, int decimals, int align, int fill, int plus, int finalizer, int eur) const;
    00163
    00164     String format(signed long long nn, int base, int field, int decimals, int align, int fill, int plus, int finalizer, int eur) const;
    00165
    00166     String format(double num, int base, int field, int decimals, int align, int fill, int plus, int finalizer, int eur) const;
    00167
    00168     String pipeline(const String& str, int base, int field, int decimals, int finalizer, int align, int eur, int fill, int negative, int plus) const;
    00169   };
    00170 }
    00171
    00172 #endif

Visualization Library v2011.05.1142 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 26 2011 22:51:21.
Permission is granted to use this page to write and publish articles regarding Visualization Library.