00001 /* 00002 * File Name: string_impl.h 00003 */ 00004 00005 /* 00006 * This file is part of uds-plugin-plaintext. 00007 * 00008 * uds-plugin-plaintext is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation, either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * uds-plugin-plaintext is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 */ 00021 00022 /** 00023 * Copyright (C) 2008 iRex Technologies B.V. 00024 * All rights reserved. 00025 */ 00026 00027 #ifndef STRING_IMPL_H_ 00028 #define STRING_IMPL_H_ 00029 00030 #include <string> 00031 #include "plugin_inc.h" 00032 #include "string_impl.h" 00033 00034 namespace text 00035 { 00036 00037 class StringImpl : public _UDSString 00038 { 00039 public: 00040 StringImpl(); 00041 explicit StringImpl(const char *str); 00042 explicit StringImpl(const std::string& str); 00043 explicit StringImpl(const StringImpl &src); 00044 ~StringImpl(); 00045 00046 public: 00047 StringImpl& operator = (const StringImpl &right); 00048 bool operator == (const StringImpl &right); 00049 std::string& stl_string() { return impl; } 00050 00051 private: 00052 /// Implement all interfaces defined by UDSString 00053 static _UDSString * assign_impl( 00054 _UDSString * thiz, 00055 const char * src); 00056 00057 /// Implement the get_buffer. 00058 static const char* get_buffer_impl( 00059 const _UDSString *thiz); 00060 00061 /// Size in bytes. 00062 static unsigned int size_impl( 00063 const _UDSString *thiz); 00064 00065 private: 00066 /// Helper functions 00067 static StringImpl * down_cast(_UDSString * ptr); 00068 static const StringImpl * down_cast(const _UDSString * ptr); 00069 00070 private: 00071 std::string impl; 00072 }; 00073 00074 }; // namespace text 00075 00076 00077 #endif 00078