include/Strings/Strings.hpp

Go to the documentation of this file.
00001 #ifndef hpp_Strings_hpp
00002 #define hpp_Strings_hpp
00003 
00004 // We need types
00005 #include "../Types/Types.hpp"
00006 // We need BString 
00007 #include "../Strings/BString.hpp"
00008 
00009 namespace Strings
00010 {
00011     typedef Bstrlib::String FastString;
00012 
00013     typedef const tchar * const tCharPtr;
00014 
00016     const unsigned int findLength(tCharPtr);
00017 
00019     class VerySimpleReadOnlyString
00020     {
00021     private:
00023         tCharPtr    data;
00025         const int   length;
00026 
00027         // Interface
00028     public:
00030         inline tCharPtr     getData() const     { return data; }
00032         inline const int    getLength() const   { return length; }
00036         inline bool limitTo(const int newLength)   { if (newLength > length) return false; *const_cast<int*>(&length) = newLength; return true; }
00037 
00038         // Construction and operators
00039     public:
00041         VerySimpleReadOnlyString(tCharPtr _data = 0, const int _length = -1) : data(_data), length(_length == -1 ? (data == 0 ? 0 : (findLength(data))) : _length) { }
00043         ~VerySimpleReadOnlyString() {}
00045         VerySimpleReadOnlyString(const VerySimpleReadOnlyString & copy) : data(copy.data), length(copy.length) {}
00047         inline const bool operator == (const VerySimpleReadOnlyString & copy) const { return length == copy.length && memcmp(data, copy.data, length) == 0; }
00049         inline const bool operator != (const VerySimpleReadOnlyString & copy) const { return !operator ==(copy); }
00050     };
00051 
00053     inline FastString   convert(const VerySimpleReadOnlyString & string) { return FastString((const void*)string.getData(), string.getLength()); }
00054 
00055 }
00056 
00057 
00058 #endif

(C) An X-Ryl669 project 2007

This document describes Unlimited Zooming Interface source code. UZI stands for Unlimited Zooming Interface, and source code license is