From: Mattia Basaglia Date: Mon, 20 Jul 2015 20:11:48 +0000 (+0200) Subject: Replace custom string classes with std::string - gone forever version X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8bc6e5aa44083645e51f499f24287ad3ff497451;p=xonotic%2Fnetradiant.git Replace custom string classes with std::string - gone forever version --- diff --git a/contrib/bobtoolz/DPlane.h b/contrib/bobtoolz/DPlane.h index 6e840cdb..69ce0eb3 100644 --- a/contrib/bobtoolz/DPlane.h +++ b/contrib/bobtoolz/DPlane.h @@ -64,7 +64,7 @@ virtual ~DPlane(); bool m_bChkOk; _QERFaceData texInfo; -CopiedString m_shader; +std::string m_shader; vec3_t points[3]; // djbob:do we really need these any more? vec3_t normal; float _d; diff --git a/contrib/prtview/prtview.cpp b/contrib/prtview/prtview.cpp index 36702213..24070336 100644 --- a/contrib/prtview/prtview.cpp +++ b/contrib/prtview/prtview.cpp @@ -43,7 +43,7 @@ #define Q3R_CMD_SHOW_2D "Toggle portals (2D)" #define Q3R_CMD_OPTIONS "Configure Portal Viewer" -CopiedString INIfn; +std::string INIfn; ///////////////////////////////////////////////////////////////////////////// // CPrtViewApp construction diff --git a/include/preferencesystem.cpp b/include/preferencesystem.cpp index 6152cb14..6bc66eef 100644 --- a/include/preferencesystem.cpp +++ b/include/preferencesystem.cpp @@ -65,7 +65,7 @@ virtual void onChanged() = 0; }; private: -CopiedString m_string; +std::string m_string; Observer& m_observer; public: StringPreference( Observer& observer ) diff --git a/libs/archivelib.h b/libs/archivelib.h index 78fc7eb5..7d2e9a3d 100644 --- a/libs/archivelib.h +++ b/libs/archivelib.h @@ -96,7 +96,7 @@ std::size_t read( char* buffer, std::size_t length ){ /// \brief An ArchiveFile which is stored uncompressed as part of a larger archive file. class StoredArchiveFile : public ArchiveFile { -CopiedString m_name; +std::string m_name; FileInputStream m_filestream; SubFileInputStream m_substream; FileInputStream::size_type m_size; @@ -129,7 +129,7 @@ InputStream& getInputStream(){ /// \brief An ArchiveTextFile which is stored uncompressed as part of a larger archive file. class StoredArchiveTextFile : public ArchiveTextFile { -CopiedString m_name; +std::string m_name; FileInputStream m_filestream; SubFileInputStream m_substream; BinaryToTextInputStream m_textStream; @@ -159,7 +159,7 @@ TextInputStream& getInputStream(){ /// \brief An ArchiveFile which is stored as a single file on disk. class DirectoryArchiveFile : public ArchiveFile { -CopiedString m_name; +std::string m_name; FileInputStream m_istream; FileInputStream::size_type m_size; public: @@ -198,7 +198,7 @@ InputStream& getInputStream(){ /// \brief An ArchiveTextFile which is stored as a single file on disk. class DirectoryArchiveTextFile : public ArchiveTextFile { -CopiedString m_name; +std::string m_name; TextFileInputStream m_inputStream; public: diff --git a/libs/container/hashfunc.h b/libs/container/hashfunc.h index 6d216697..59a34c7d 100644 --- a/libs/container/hashfunc.h +++ b/libs/container/hashfunc.h @@ -314,7 +314,7 @@ struct RawStringHash struct HashString { typedef hash_t hash_type; - hash_type operator()( const CopiedString& string ) const { + hash_type operator()( const std::string& string ) const { return string_hash( string.c_str() ); } }; @@ -322,7 +322,7 @@ struct HashString struct HashStringNoCase { typedef hash_t hash_type; - hash_type operator()( const CopiedString& string ) const { + hash_type operator()( const std::string& string ) const { return string_hash_nocase( string.c_str() ); } }; diff --git a/libs/container/hashtable.cpp b/libs/container/hashtable.cpp index edcaff63..5e49e0e8 100644 --- a/libs/container/hashtable.cpp +++ b/libs/container/hashtable.cpp @@ -29,7 +29,7 @@ namespace ExampleHashTable { void testStuff(){ // HashTable example - typedef HashTable MyHashTable; + typedef HashTable MyHashTable; MyHashTable hashtable; hashtable["bleh"] = 5; hashtable.insert( "blah", 17 ); diff --git a/libs/eclasslib.h b/libs/eclasslib.h index d2730d62..ac0718b3 100644 --- a/libs/eclasslib.h +++ b/libs/eclasslib.h @@ -38,7 +38,7 @@ typedef Vector3 Colour3; class ListAttributeType { -typedef std::pair ListItem; +typedef std::pair ListItem; typedef std::vector ListItems; ListItems m_items; public: @@ -72,19 +72,19 @@ void push_back( const char* name, const char* value ){ class EntityClassAttribute { public: -CopiedString m_type; -CopiedString m_name; -CopiedString m_value; -CopiedString m_description; +std::string m_type; +std::string m_name; +std::string m_value; +std::string m_description; EntityClassAttribute(){ } EntityClassAttribute( const char* type, const char* name, const char* value = "", const char* description = "" ) : m_type( type ), m_name( name ), m_value( value ), m_description( description ){ } }; -typedef std::pair EntityClassAttributePair; +typedef std::pair EntityClassAttributePair; typedef std::list EntityClassAttributes; -typedef std::list StringList; +typedef std::list StringList; inline const char* EntityClassAttributePair_getName( const EntityClassAttributePair& attributePair ){ if ( !string_empty( attributePair.second.m_name.c_str() ) ) { @@ -103,7 +103,7 @@ inline const char* EntityClassAttributePair_getDescription( const EntityClassAtt class EntityClass { public: -CopiedString m_name; +std::string m_name; StringList m_parent; bool fixedsize; bool unknown; // wasn't found in source @@ -115,11 +115,11 @@ Shader* m_state_fill; Shader* m_state_wire; Shader* m_state_blend; -CopiedString m_comments; +std::string m_comments; char flagnames[MAX_FLAGS][32]; -CopiedString m_modelpath; -CopiedString m_skin; +std::string m_modelpath; +std::string m_skin; void ( *free )( EntityClass* ); diff --git a/libs/entitylib.h b/libs/entitylib.h index 7f1bb0c1..80162f30 100644 --- a/libs/entitylib.h +++ b/libs/entitylib.h @@ -297,9 +297,9 @@ typedef UnsortedSet KeyObservers; std::size_t m_refcount; KeyObservers m_observers; -CopiedString m_string; +std::string m_string; const char* m_empty; -ObservedUndoableObject m_undo; +ObservedUndoableObject m_undo; static EntityCreator::KeyValueChangedFunc m_entityKeyValueChanged; public: @@ -361,12 +361,12 @@ void notify(){ } } -void importState( const CopiedString& string ){ +void importState( const std::string& string ){ m_string = string; notify(); } -typedef MemberCaller1 UndoImportCaller; +typedef MemberCaller1 UndoImportCaller; }; /// \brief An unsorted list of key/value pairs. @@ -614,7 +614,7 @@ public: /// \brief The resource is released when the ResourceReference is destroyed. class ResourceReference { - CopiedString m_name; + std::string m_name; Resource* m_resource; public: ResourceReference( const char* name ) diff --git a/libs/fs_filesystem.h b/libs/fs_filesystem.h index d181f702..a3c2e0f3 100644 --- a/libs/fs_filesystem.h +++ b/libs/fs_filesystem.h @@ -48,7 +48,7 @@ class GenericFileSystem { class Path { -CopiedString m_path; +std::string m_path; unsigned int m_depth; public: Path( const char* path ) diff --git a/libs/gtkutil/filechooser.cpp b/libs/gtkutil/filechooser.cpp index d65d310c..a47019f1 100644 --- a/libs/gtkutil/filechooser.cpp +++ b/libs/gtkutil/filechooser.cpp @@ -59,9 +59,9 @@ struct filetype_copy_t filetype_copy_t( const filetype_pair_t& other ) : m_moduleName( other.m_moduleName ), m_name( other.m_type.name ), m_pattern( other.m_type.pattern ){ } - CopiedString m_moduleName; - CopiedString m_name; - CopiedString m_pattern; + std::string m_moduleName; + std::string m_name; + std::string m_pattern; }; typedef std::list Types; @@ -90,8 +90,8 @@ class GTKMasks { const FileTypeList& m_types; public: -std::vector m_filters; -std::vector m_masks; +std::vector m_filters; +std::vector m_masks; GTKMasks( const FileTypeList& types ) : m_types( types ){ m_masks.reserve( m_types.size() ); @@ -113,7 +113,7 @@ GTKMasks( const FileTypeList& types ) : m_types( types ){ } filetype_pair_t GetTypeForGTKMask( const char *mask ) const { - std::vector::const_iterator j = m_masks.begin(); + std::vector::const_iterator j = m_masks.begin(); for ( FileTypeList::const_iterator i = m_types.begin(); i != m_types.end(); ++i, ++j ) { if ( string_equal( ( *j ).c_str(), mask ) ) { diff --git a/libs/gtkutil/image.cpp b/libs/gtkutil/image.cpp index 4605d3f5..59d219dc 100644 --- a/libs/gtkutil/image.cpp +++ b/libs/gtkutil/image.cpp @@ -31,7 +31,7 @@ namespace { -CopiedString g_bitmapsPath; +std::string g_bitmapsPath; } void BitmapsPath_set( const char* path ){ diff --git a/libs/maplib.h b/libs/maplib.h index 07da39dc..b1566a77 100644 --- a/libs/maplib.h +++ b/libs/maplib.h @@ -36,7 +36,7 @@ class NameableString : public Nameable { -CopiedString m_name; +std::string m_name; public: NameableString( const char* name ) : m_name( name ){ diff --git a/libs/modulesystem/modulesmap.h b/libs/modulesystem/modulesmap.h index a48a083b..f9d657fa 100644 --- a/libs/modulesystem/modulesmap.h +++ b/libs/modulesystem/modulesmap.h @@ -30,7 +30,7 @@ template class ModulesMap : public Modules { -typedef std::map modules_t; +typedef std::map modules_t; modules_t m_modules; public: ~ModulesMap(){ diff --git a/libs/shaderlib.h b/libs/shaderlib.h index ee972437..80afbe2f 100644 --- a/libs/shaderlib.h +++ b/libs/shaderlib.h @@ -45,7 +45,7 @@ inline bool shader_equal_prefix( const char* string, const char* prefix ){ class shader_less_t { public: -bool operator()( const CopiedString& shader, const CopiedString& other ) const { +bool operator()( const std::string& shader, const std::string& other ) const { return shader_less( shader.c_str(), other.c_str() ); } }; diff --git a/libs/string/string.cpp b/libs/string/string.cpp deleted file mode 100644 index ccca51c5..00000000 --- a/libs/string/string.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - Copyright (C) 2001-2006, William Joseph. - All Rights Reserved. - - This file is part of GtkRadiant. - - GtkRadiant is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - GtkRadiant is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GtkRadiant; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "string.h" - -/// \note Never called... -void TestString(){ - CopiedString bleh( "bleh" ); - //SmartString blah( "blah" ); -} diff --git a/libs/string/string.h b/libs/string/string.h index 7ab7e66b..835151dd 100644 --- a/libs/string/string.h +++ b/libs/string/string.h @@ -288,224 +288,17 @@ const char* getToken(){ } }; -#if 0 -/// \brief A non-mutable c-style string. -/// -/// \param Buffer The string storage implementation. Must be DefaultConstructible, CopyConstructible and Assignable. Must implement: -/// \li Buffer(const char* string) - constructor which copies a c-style \p string. -/// \li Buffer(const char* first, const char*) - constructor which copies a c-style string range [\p first, \p last). -/// \li void swap(Buffer& other) - swaps contents with \p other. -/// \li const char* c_str() - returns the stored non-mutable c-style string. -template -class String : public Buffer -{ -public: - -String() - : Buffer(){ -} -String( const char* string ) - : Buffer( string ){ -} -String( StringRange range ) - : Buffer( range ){ -} - -String& operator=( const String& other ){ - String temp( other ); - temp.swap( *this ); - return *this; -} -String& operator=( const char* string ){ - String temp( string ); - temp.swap( *this ); - return *this; -} -String& operator=( StringRange range ){ - String temp( range ); - temp.swap( *this ); - return *this; -} - -void swap( String& other ){ - Buffer::swap( other ); -} - -bool empty() const { - return string_empty( Buffer::c_str() ); -} -}; - -template -inline bool operator<( const String& self, const String& other ){ - return string_less( self.c_str(), other.c_str() ); -} - -template -inline bool operator>( const String& self, const String& other ){ - return string_greater( self.c_str(), other.c_str() ); -} - -template -inline bool operator==( const String& self, const String& other ){ - return string_equal( self.c_str(), other.c_str() ); -} - -template -inline bool operator!=( const String& self, const String& other ){ - return !string_equal( self.c_str(), other.c_str() ); -} - -template -inline bool operator==( const String& self, const char* other ){ - return string_equal( self.c_str(), other ); -} - -template -inline bool operator!=( const String& self, const char* other ){ - return !string_equal( self.c_str(), other ); -} - -namespace std -{ -/// \brief Swaps the values of \p self and \p other. -/// Overloads std::swap. -template -inline void swap( String& self, String& other ){ - self.swap( other ); -} -} - - -/// \brief A non-mutable string buffer which manages memory allocation. -template -class CopiedBuffer : private Allocator -{ -char* m_string; - -char* copy_range( StringRange range ){ - return string_clone_range( range, static_cast( *this ) ); -} -char* copy( const char* other ){ - return string_clone( other, static_cast( *this ) ); -} -void destroy( char* string ){ - string_release( string, string_length( string ), static_cast( *this ) ); -} - -protected: -~CopiedBuffer(){ - destroy( m_string ); -} -public: -CopiedBuffer() - : m_string( copy( "" ) ){ -} -explicit CopiedBuffer( const Allocator& allocator ) - : Allocator( allocator ), m_string( copy( "" ) ){ -} -CopiedBuffer( const CopiedBuffer& other ) - : Allocator( other ), m_string( copy( other.m_string ) ){ -} -CopiedBuffer( const char* string, const Allocator& allocator = Allocator() ) - : Allocator( allocator ), m_string( copy( string ) ){ -} -CopiedBuffer( StringRange range, const Allocator& allocator = Allocator() ) - : Allocator( allocator ), m_string( copy_range( range ) ){ -} -const char* c_str() const { - return m_string; -} -void swap( CopiedBuffer& other ){ - string_swap( m_string, other.m_string ); -} -}; - -/// \brief A non-mutable string which uses copy-by-value for assignment. -typedef String< CopiedBuffer< DefaultAllocator > > CopiedString; - -/// \brief A non-mutable string buffer which uses reference-counting to avoid unnecessary allocations. -template -class SmartBuffer : private Allocator -{ -char* m_buffer; - -char* copy_range( StringRange range ){ - char* buffer = Allocator::allocate( sizeof( std::size_t ) + ( range.last - range.first ) + 1 ); - strncpy( buffer + sizeof( std::size_t ), range.first, range.last - range.first ); - buffer[sizeof( std::size_t ) + ( range.last - range.first )] = '\0'; - *reinterpret_cast( buffer ) = 0; - return buffer; -} -char* copy( const char* string ){ - char* buffer = Allocator::allocate( sizeof( std::size_t ) + string_length( string ) + 1 ); - strcpy( buffer + sizeof( std::size_t ), string ); - *reinterpret_cast( buffer ) = 0; - return buffer; -} -void destroy( char* buffer ){ - Allocator::deallocate( buffer, sizeof( std::size_t ) + string_length( c_str() ) + 1 ); -} - -void incref( char* buffer ){ - ++( *reinterpret_cast( buffer ) ); -} -void decref( char* buffer ){ - if ( --( *reinterpret_cast( buffer ) ) == 0 ) { - destroy( buffer ); - } -} - -protected: -~SmartBuffer(){ - decref( m_buffer ); -} -public: -SmartBuffer() - : m_buffer( copy( "" ) ){ - incref( m_buffer ); -} -explicit SmartBuffer( const Allocator& allocator ) - : Allocator( allocator ), m_buffer( copy( "" ) ){ - incref( m_buffer ); -} -SmartBuffer( const SmartBuffer& other ) - : Allocator( other ), m_buffer( other.m_buffer ){ - incref( m_buffer ); -} -SmartBuffer( const char* string, const Allocator& allocator = Allocator() ) - : Allocator( allocator ), m_buffer( copy( string ) ){ - incref( m_buffer ); -} -SmartBuffer( StringRange range, const Allocator& allocator = Allocator() ) - : Allocator( allocator ), m_buffer( copy_range( range ) ){ - incref( m_buffer ); -} -const char* c_str() const { - return m_buffer + sizeof( std::size_t ); -} -void swap( SmartBuffer& other ){ - string_swap( m_buffer, other.m_buffer ); -} -}; - -/// \brief A non-mutable string which uses copy-by-reference for assignment of SmartString. -typedef String< SmartBuffer< DefaultAllocator > > SmartString; -#endif - -typedef std::string CopiedString; - class StringEqualNoCase { public: -bool operator()( const CopiedString& key, const CopiedString& other ) const { +bool operator()( const std::string& key, const std::string& other ) const { return string_equal_nocase( key.c_str(), other.c_str() ); } }; struct StringLessNoCase { - bool operator()( const CopiedString& x, const CopiedString& y ) const { + bool operator()( const std::string& x, const std::string& y ) const { return string_less_nocase( x.c_str(), y.c_str() ); } }; diff --git a/libs/string/stringfwd.cpp b/libs/string/stringfwd.cpp deleted file mode 100644 index add6eeee..00000000 --- a/libs/string/stringfwd.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - Copyright (C) 2001-2006, William Joseph. - All Rights Reserved. - - This file is part of GtkRadiant. - - GtkRadiant is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - GtkRadiant is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GtkRadiant; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "stringfwd.h" diff --git a/libs/string/stringfwd.h b/libs/string/stringfwd.h deleted file mode 100644 index 1946a090..00000000 --- a/libs/string/stringfwd.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright (C) 2001-2006, William Joseph. - All Rights Reserved. - - This file is part of GtkRadiant. - - GtkRadiant is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - GtkRadiant is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GtkRadiant; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#if !defined( INCLUDED_STRING_STRINGFWD_H ) -#define INCLUDED_STRING_STRINGFWD_H - -#include - -// forward-declaration of CopiedString - -template -class DefaultAllocator; -/*template -class CopiedBuffer; -template -class String; -typedef String< CopiedBuffer< DefaultAllocator > > CopiedString;*/ -typedef std::string CopiedString; - -#endif diff --git a/libs/stringio.h b/libs/stringio.h index 8af056e6..174f15fa 100644 --- a/libs/stringio.h +++ b/libs/stringio.h @@ -289,14 +289,14 @@ inline TextOutputStreamType& ostream_write( TextOutputStreamType& outputStream, -inline void CopiedString_importString( CopiedString& self, const char* string ){ +inline void CopiedString_importString( std::string& self, const char* string ){ self = string; } -typedef ReferenceCaller1 CopiedStringImportStringCaller; -inline void CopiedString_exportString( const CopiedString& self, const StringImportCallback& importer ){ +typedef ReferenceCaller1 CopiedStringImportStringCaller; +inline void CopiedString_exportString( const std::string& self, const StringImportCallback& importer ){ importer( self.c_str() ); } -typedef ConstReferenceCaller1 CopiedStringExportStringCaller; +typedef ConstReferenceCaller1 CopiedStringExportStringCaller; inline void Bool_importString( bool& self, const char* string ){ self = string_equal( string, "true" ); diff --git a/libs/uniquenames.h b/libs/uniquenames.h index 8ff67f15..8871a439 100644 --- a/libs/uniquenames.h +++ b/libs/uniquenames.h @@ -97,7 +97,7 @@ bool operator!=( const Postfix& other ) const { #endif -typedef std::pair name_t; +typedef std::pair name_t; inline void name_write( char* buffer, name_t name ){ strcpy( buffer, name.first.c_str() ); @@ -114,7 +114,7 @@ inline name_t name_read( const char* name ){ end = p; } - return name_t( CopiedString( StringRange( name, end ) ), Postfix( end ) ); + return name_t( std::string( StringRange( name, end ) ), Postfix( end ) ); } @@ -180,7 +180,7 @@ bool empty() const { class UniqueNames { -typedef std::map names_t; +typedef std::map names_t; names_t m_names; public: name_t make_unique( const name_t& name ) const { diff --git a/libs/xml/xmlelement.h b/libs/xml/xmlelement.h index 5bedf554..58f60aa7 100644 --- a/libs/xml/xmlelement.h +++ b/libs/xml/xmlelement.h @@ -65,7 +65,7 @@ attrs_t m_attrs; ///\brief All string pointers passed to an instance of this class are copied. class DynamicElement : public XMLElement { -typedef std::map attrs_t; +typedef std::map attrs_t; public: DynamicElement( const char* name ) : m_name( name ){ @@ -92,7 +92,7 @@ void forEachAttribute( XMLAttrVisitor& visitor ) const { } } private: -CopiedString m_name; +std::string m_name; attrs_t m_attrs; }; diff --git a/libs/xml/xmltextags.cpp b/libs/xml/xmltextags.cpp index 7baf0e5e..b9634ad4 100644 --- a/libs/xml/xmltextags.cpp +++ b/libs/xml/xmltextags.cpp @@ -361,7 +361,7 @@ bool XmlTagBuilder::AddShaderTag( const char* shader, const char* content, NodeT } //int XmlTagBuilder::RenameShaderTag(const char* oldtag, const char* newtag) -int XmlTagBuilder::RenameShaderTag( const char* oldtag, CopiedString newtag ){ +int XmlTagBuilder::RenameShaderTag( const char* oldtag, std::string newtag ){ /* Replaces tag node contents char* oldtag - the node content that sould be changed @@ -457,9 +457,9 @@ bool XmlTagBuilder::DeleteTag( const char* tag ){ strcat( expression, tag ); strcat( expression, "']" ); - std::set dellist; + std::set dellist; TagSearch( expression, dellist ); - std::set::iterator iter; + std::set::iterator iter; for ( iter = dellist.begin(); iter != dellist.end(); iter++ ) { @@ -470,7 +470,7 @@ bool XmlTagBuilder::DeleteTag( const char* tag ){ return true; } -void XmlTagBuilder::GetShaderTags( const char* shader, std::vector& tags ){ +void XmlTagBuilder::GetShaderTags( const char* shader, std::vector& tags ){ /* Gets the tags from a shader char* shader - the name of the shader @@ -500,13 +500,13 @@ void XmlTagBuilder::GetShaderTags( const char* shader, std::vector if ( !xmlXPathNodeSetIsEmpty( nodePtr ) ) { for ( int i = 0; i < nodePtr->nodeNr; i++ ) { - tags.push_back( (CopiedString)(char*)xmlNodeGetContent( nodePtr->nodeTab[i] ) ); + tags.push_back( (std::string)(char*)xmlNodeGetContent( nodePtr->nodeTab[i] ) ); } } xmlXPathFreeObject( xpathPtr ); } -void XmlTagBuilder::GetUntagged( std::set& shaders ){ +void XmlTagBuilder::GetUntagged( std::set& shaders ){ /* Gets all textures and shaders listed in the xml file that don't have any tag returns a set containing the shaders (with path) @@ -536,7 +536,7 @@ void XmlTagBuilder::GetUntagged( std::set& shaders ){ xmlXPathFreeObject( xpathPtr ); } -void XmlTagBuilder::GetAllTags( std::set& tags ){ +void XmlTagBuilder::GetAllTags( std::set& tags ){ /* Gets a list of all tags that are used (assigned to any shader) returns a set containing all used tags @@ -556,14 +556,14 @@ void XmlTagBuilder::GetAllTags( std::set& tags ){ if ( !xmlXPathNodeSetIsEmpty( nodePtr ) ) { for ( int i = 0; i < nodePtr->nodeNr; i++ ) { - tags.insert( (CopiedString)(char*)xmlNodeGetContent( nodePtr->nodeTab[i] ) ); + tags.insert( (std::string)(char*)xmlNodeGetContent( nodePtr->nodeTab[i] ) ); } } xmlXPathFreeObject( xpathPtr ); } -void XmlTagBuilder::TagSearch( const char* expression, std::set& paths ){ +void XmlTagBuilder::TagSearch( const char* expression, std::set& paths ){ /* Searches shaders by tags char* expression - the XPath expression to search @@ -587,7 +587,7 @@ void XmlTagBuilder::TagSearch( const char* expression, std::set& p { ptr = nodePtr->nodeTab[i]; xmlattrib = xmlGetProp( ptr, (const xmlChar*)"path" ); - paths.insert( (CopiedString)(char*)xmlattrib ); + paths.insert( (std::string)(char*)xmlattrib ); } } xmlXPathFreeObject( xpathPtr ); diff --git a/libs/xml/xmltextags.h b/libs/xml/xmltextags.h index dbad5f56..8599fca3 100644 --- a/libs/xml/xmltextags.h +++ b/libs/xml/xmltextags.h @@ -52,7 +52,7 @@ enum TextureType class XmlTagBuilder { private: -CopiedString m_savefilename; +std::string m_savefilename; xmlDocPtr doc; xmlXPathContextPtr context; xmlNodeSetPtr nodePtr; @@ -93,12 +93,12 @@ bool CheckShaderTag( const char* shader ); bool CheckShaderTag( const char* shader, const char* content ); bool AddShaderTag( const char* shader, const char* content, NodeTagType nodeTagType ); bool DeleteTag( const char* tag ); -int RenameShaderTag( const char* oldtag, CopiedString newtag ); +int RenameShaderTag( const char* oldtag, std::string newtag ); bool DeleteShaderTag( const char* shader, const char* tag ); -void GetShaderTags( const char* shader, std::vector& tags ); -void GetUntagged( std::set& shaders ); -void GetAllTags( std::set& tags ); -void TagSearch( const char* expression, std::set& paths ); +void GetShaderTags( const char* shader, std::vector& tags ); +void GetUntagged( std::set& shaders ); +void GetAllTags( std::set& tags ); +void TagSearch( const char* expression, std::set& paths ); }; #endif diff --git a/plugins/archivepak/archive.cpp b/plugins/archivepak/archive.cpp index 785c2dda..46215ef6 100644 --- a/plugins/archivepak/archive.cpp +++ b/plugins/archivepak/archive.cpp @@ -64,7 +64,7 @@ unsigned int m_stream_size; typedef GenericFileSystem PakFileSystem; PakFileSystem m_filesystem; FileInputStream m_pakfile; -CopiedString m_name; +std::string m_name; public: diff --git a/plugins/archivewad/archive.cpp b/plugins/archivewad/archive.cpp index 793cb0e7..b9490bf9 100644 --- a/plugins/archivewad/archive.cpp +++ b/plugins/archivewad/archive.cpp @@ -58,9 +58,9 @@ enum EWadVersion eWAD3, }; -typedef std::map files_t; +typedef std::map files_t; files_t m_files; -CopiedString m_name; +std::string m_name; FileInputStream m_wadfile; EWadVersion wad_version( const char* identification ){ diff --git a/plugins/archivezip/archive.cpp b/plugins/archivezip/archive.cpp index a8616e62..1136a5c0 100644 --- a/plugins/archivezip/archive.cpp +++ b/plugins/archivezip/archive.cpp @@ -34,7 +34,7 @@ class DeflatedArchiveFile : public ArchiveFile { -CopiedString m_name; +std::string m_name; FileInputStream m_istream; SubFileInputStream m_substream; DeflatedInputStream m_zipstream; @@ -63,7 +63,7 @@ InputStream& getInputStream(){ class DeflatedArchiveTextFile : public ArchiveTextFile { -CopiedString m_name; +std::string m_name; FileInputStream m_istream; SubFileInputStream m_substream; DeflatedInputStream m_zipstream; @@ -112,7 +112,7 @@ ECompressionMode m_mode; typedef GenericFileSystem ZipFileSystem; ZipFileSystem m_filesystem; -CopiedString m_name; +std::string m_name; FileInputStream m_istream; bool read_record(){ diff --git a/plugins/entity/doom3group.cpp b/plugins/entity/doom3group.cpp index b53017c5..dc4ace44 100644 --- a/plugins/entity/doom3group.cpp +++ b/plugins/entity/doom3group.cpp @@ -106,8 +106,8 @@ mutable AABB m_curveBounds; Callback m_transformChanged; Callback m_evaluateTransform; -CopiedString m_name; -CopiedString m_modelKey; +std::string m_name; +std::string m_modelKey; bool m_isModel; scene::Traversable* m_traversable; diff --git a/plugins/entity/light.cpp b/plugins/entity/light.cpp index 0b559893..10912182 100644 --- a/plugins/entity/light.cpp +++ b/plugins/entity/light.cpp @@ -660,7 +660,7 @@ inline void default_extents( Vector3& extents ){ class ShaderRef { -CopiedString m_name; +std::string m_name; Shader* m_shader; void capture(){ m_shader = GlobalShaderCache().capture( m_name.c_str() ); diff --git a/plugins/entity/modelskinkey.h b/plugins/entity/modelskinkey.h index 34d91112..fdac8831 100644 --- a/plugins/entity/modelskinkey.h +++ b/plugins/entity/modelskinkey.h @@ -30,7 +30,7 @@ #include "entitylib.h" #include "traverselib.h" -inline void parseTextureName( CopiedString& name, const char* token ){ +inline void parseTextureName( std::string& name, const char* token ){ StringOutputStream cleaned( 256 ); cleaned << PathCleaned( token ); name = StringRange( cleaned.c_str(), path_get_filename_base_end( cleaned.c_str() ) ); // remove extension @@ -38,7 +38,7 @@ inline void parseTextureName( CopiedString& name, const char* token ){ class ModelSkinKey : public ModuleObserver { -CopiedString m_name; +std::string m_name; ModelSkin* m_skin; Callback m_skinChangedCallback; diff --git a/plugins/entity/namedentity.h b/plugins/entity/namedentity.h index 29170d9e..bddded22 100644 --- a/plugins/entity/namedentity.h +++ b/plugins/entity/namedentity.h @@ -52,7 +52,7 @@ class NamedEntity : public Nameable { EntityKeyValues& m_entity; NameCallbackSet m_changed; -CopiedString m_name; +std::string m_name; public: NamedEntity( EntityKeyValues& entity ) : m_entity( entity ){ } diff --git a/plugins/entity/namekeys.h b/plugins/entity/namekeys.h index 0e2d88b3..a984a089 100644 --- a/plugins/entity/namekeys.h +++ b/plugins/entity/namekeys.h @@ -58,7 +58,7 @@ KeyIsNameFunc m_keyIsName; NameKeys( const NameKeys& other ); NameKeys& operator=( const NameKeys& other ); -typedef std::map KeyValues; +typedef std::map KeyValues; KeyValues m_keyValues; void insertName( const char* key, EntityKeyValue& value ){ diff --git a/plugins/entity/skincache.cpp b/plugins/entity/skincache.cpp index fce3c1a1..c65355d9 100644 --- a/plugins/entity/skincache.cpp +++ b/plugins/entity/skincache.cpp @@ -37,7 +37,7 @@ #include "modulesystem/singletonmodule.h" #include "stringio.h" -void parseShaderName( CopiedString& name, const char* token ){ +void parseShaderName( std::string& name, const char* token ){ StringOutputStream cleaned( 256 ); cleaned << PathCleaned( token ); name = cleaned.c_str(); @@ -45,7 +45,7 @@ void parseShaderName( CopiedString& name, const char* token ){ class Doom3ModelSkin { -typedef std::map Remaps; +typedef std::map Remaps; Remaps m_remaps; public: bool parseTokens( Tokeniser& tokeniser ){ @@ -67,7 +67,7 @@ bool parseTokens( Tokeniser& tokeniser ){ } else { - CopiedString from, to; + std::string from, to; parseShaderName( from, token ); tokeniser.nextLine(); // hack to handle badly formed skins @@ -99,7 +99,7 @@ void forEachRemap( const SkinRemapCallback& callback ) const { class GlobalSkins { public: -typedef std::map SkinMap; +typedef std::map SkinMap; SkinMap m_skins; Doom3ModelSkin g_nullSkin; @@ -130,7 +130,7 @@ bool parseTokens( Tokeniser& tokeniser ){ Tokeniser_unexpectedError( tokeniser, token, "#string" ); return false; } - CopiedString name; + std::string name; parseShaderName( name, other ); Doom3ModelSkin& skin = m_skins[name]; RETURN_FALSE_IF_FAIL( skin.parseTokens( tokeniser ) ); @@ -228,7 +228,7 @@ public: explicit CreateDoom3ModelSkin( Doom3ModelSkinCache& cache ) : m_cache( cache ){ } -Doom3ModelSkinCacheElement* construct( const CopiedString& name ){ +Doom3ModelSkinCacheElement* construct( const std::string& name ){ Doom3ModelSkinCacheElement* skin = new Doom3ModelSkinCacheElement; if ( m_cache.realised() ) { skin->realise( name.c_str() ); @@ -243,7 +243,7 @@ void destroy( Doom3ModelSkinCacheElement* skin ){ } }; -typedef HashedCache, CreateDoom3ModelSkin> Cache; +typedef HashedCache, CreateDoom3ModelSkin> Cache; Cache m_cache; bool m_realised; diff --git a/plugins/entity/targetable.cpp b/plugins/entity/targetable.cpp index e041ee99..b334310d 100644 --- a/plugins/entity/targetable.cpp +++ b/plugins/entity/targetable.cpp @@ -21,7 +21,7 @@ #include "targetable.h" -typedef std::map targetnames_t; +typedef std::map targetnames_t; const char* g_targetable_nameKey = "targetname"; diff --git a/plugins/mapq3/parse.cpp b/plugins/mapq3/parse.cpp index 03b1acae..7d3ef3cc 100644 --- a/plugins/mapq3/parse.cpp +++ b/plugins/mapq3/parse.cpp @@ -38,7 +38,7 @@ inline MapImporter* Node_getMapImporter( scene::Node& node ){ } -typedef std::list< std::pair > KeyValues; +typedef std::list< std::pair > KeyValues; NodeSmartReference g_nullNode( NewNullNode() ); @@ -99,7 +99,7 @@ NodeSmartReference Entity_parseTokens( Tokeniser& tokeniser, EntityCreator& enti } else // epair { - CopiedString key( token ); + std::string key( token ); token = tokeniser.getToken(); if ( token == 0 ) { Tokeniser_unexpectedError( tokeniser, token, "#epair-value" ); diff --git a/plugins/mapq3/plugin.cpp b/plugins/mapq3/plugin.cpp index e21cf22d..87c08507 100644 --- a/plugins/mapq3/plugin.cpp +++ b/plugins/mapq3/plugin.cpp @@ -524,7 +524,7 @@ void VMF_parseBlock( Tokeniser& tokeniser, const VMFBlock& block ){ tokeniser.ungetToken(); break; } - CopiedString tmp( key ); + std::string tmp( key ); tokeniser.nextLine(); const char* value = tokeniser.getToken(); tokeniser.nextLine(); diff --git a/plugins/md3model/model.h b/plugins/md3model/model.h index ee760064..8be39098 100644 --- a/plugins/md3model/model.h +++ b/plugins/md3model/model.h @@ -65,7 +65,7 @@ inline VertexPointer vertexpointer_arbitrarymeshvertex( const ArbitraryMeshVerte return VertexPointer( VertexPointer::pointer( &array->vertex ), sizeof( ArbitraryMeshVertex ) ); } -inline void parseTextureName( CopiedString& name, const char* token ){ +inline void parseTextureName( std::string& name, const char* token ){ StringOutputStream cleaned( 256 ); cleaned << PathCleaned( token ); name = StringRange( cleaned.c_str(), path_get_filename_base_end( cleaned.c_str() ) ); // remove extension @@ -81,7 +81,7 @@ typedef IndexBuffer indices_t; private: AABB m_aabb_local; -CopiedString m_shader; +std::string m_shader; Shader* m_state; vertices_t m_vertices; @@ -324,7 +324,7 @@ SurfaceLightLists m_surfaceLightLists; class Remap { public: -CopiedString first; +std::string first; Shader* second; Remap() : second( 0 ){ } diff --git a/plugins/model/model.cpp b/plugins/model/model.cpp index defa472a..ee5f674b 100644 --- a/plugins/model/model.cpp +++ b/plugins/model/model.cpp @@ -69,7 +69,7 @@ class PicoSurface : public OpenGLRenderable { AABB m_aabb_local; -CopiedString m_shader; +std::string m_shader; Shader* m_state; Array m_vertices; @@ -310,7 +310,7 @@ void constructNull(){ }; -typedef std::pair PicoModelKey; +typedef std::pair PicoModelKey; class PicoModel : @@ -446,7 +446,7 @@ SurfaceLightLists m_surfaceLightLists; class Remap { public: -CopiedString first; +std::string first; Shader* second; Remap() : second( 0 ){ } @@ -808,18 +808,18 @@ void parse_namestr( const char *name ){ if ( !hasName && ( *ptr == ':' || *ptr == '\0' ) ) { // model name hasName = true; - m_name = CopiedString( s, ptr ); + m_name = std::string( s, ptr ); s = ptr + 1; } else if ( *ptr == '?' || *ptr == '\0' ) { // model frame hasFrame = true; - m_frame = atoi( CopiedString( s, ptr ).c_str() ); + m_frame = atoi( std::string( s, ptr ).c_str() ); s = ptr + 1; } else if ( *ptr == '&' || *ptr == '\0' ) { // a remap - add_remap( CopiedString( s, ptr ).c_str() ); + add_remap( std::string( s, ptr ).c_str() ); s = ptr + 1; } @@ -857,13 +857,13 @@ inline const char* shader_for_remap( const char* remap ){ return ""; } -CopiedString m_name; +std::string m_name; int m_frame; PicoModel* m_model; typedef std::vector remaps_t; remaps_t m_remaps; -typedef std::vector shaders_t; +typedef std::vector shaders_t; shaders_t m_shaders; typedef std::vector states_t; states_t m_states; diff --git a/plugins/model/plugin.cpp b/plugins/model/plugin.cpp index 61e77628..88a234a9 100644 --- a/plugins/model/plugin.cpp +++ b/plugins/model/plugin.cpp @@ -133,7 +133,7 @@ ModelLoader* getTable(){ class PicoModelAPIConstructor { -CopiedString m_extension; +std::string m_extension; const picoModule_t* m_module; public: PicoModelAPIConstructor( const char* extension, const picoModule_t* module ) : diff --git a/plugins/shaders/shaders.cpp b/plugins/shaders/shaders.cpp index a431ef4f..39310e8a 100644 --- a/plugins/shaders/shaders.cpp +++ b/plugins/shaders/shaders.cpp @@ -223,7 +223,7 @@ typedef Static ShaderPool; typedef PooledString ShaderString; typedef ShaderString ShaderVariable; typedef ShaderString ShaderValue; -typedef CopiedString TextureExpression; +typedef std::string TextureExpression; // clean a texture name to the qtexture_t name format we use internally // NOTE: case sensitivity: the engine is case sensitive. we store the shader name with case information and save with case @@ -234,7 +234,7 @@ template void parseTextureName( StringType& name, const char* token ){ StringOutputStream cleaned( 256 ); cleaned << PathCleaned( token ); - name = CopiedString( StringRange( cleaned.c_str(), path_get_filename_base_end( cleaned.c_str() ) ) ).c_str(); // remove extension + name = std::string( StringRange( cleaned.c_str(), path_get_filename_base_end( cleaned.c_str() ) ) ).c_str(); // remove extension } bool Tokeniser_parseTextureName( Tokeniser& tokeniser, TextureExpression& name ){ @@ -247,7 +247,7 @@ bool Tokeniser_parseTextureName( Tokeniser& tokeniser, TextureExpression& name ) return true; } -bool Tokeniser_parseShaderName( Tokeniser& tokeniser, CopiedString& name ){ +bool Tokeniser_parseShaderName( Tokeniser& tokeniser, std::string& name ){ const char* token = tokeniser.getToken(); if ( token == 0 ) { Tokeniser_unexpectedError( tokeniser, token, "#shader-name" ); @@ -277,7 +277,7 @@ typedef std::pair BlendFuncExpression; class ShaderTemplate { std::size_t m_refcount; -CopiedString m_Name; +std::string m_Name; public: ShaderParameters m_params; @@ -676,7 +676,7 @@ bool ShaderTemplate::parseDoom3( Tokeniser& tokeniser ){ } typedef SmartPointer ShaderTemplatePointer; -typedef std::map ShaderTemplateMap; +typedef std::map ShaderTemplateMap; ShaderTemplateMap g_shaders; ShaderTemplateMap g_shaderTemplates; @@ -700,12 +700,12 @@ ShaderArguments args; const char* filename; }; -typedef std::map ShaderDefinitionMap; +typedef std::map ShaderDefinitionMap; ShaderDefinitionMap g_shaderDefinitions; bool parseTemplateInstance( Tokeniser& tokeniser, const char* filename ){ - CopiedString name; + std::string name; RETURN_FALSE_IF_FAIL( Tokeniser_parseShaderName( tokeniser, name ) ); const char* templateName = tokeniser.getToken(); ShaderTemplate* shaderTemplate = findTemplate( templateName ); @@ -838,7 +838,7 @@ const ShaderTemplate& m_template; const ShaderArguments& m_args; const char* m_filename; // name is shader-name, otherwise texture-name (if not a real shader) -CopiedString m_Name; +std::string m_Name; qtexture_t* m_pTexture; qtexture_t* m_notfound; @@ -1102,7 +1102,7 @@ qtexture_t* lightFalloffImage() const { bool CShader::m_lightingEnabled = false; typedef SmartPointer ShaderPointer; -typedef std::map shaders_t; +typedef std::map shaders_t; shaders_t g_ActiveShaders; @@ -1301,7 +1301,7 @@ Layer() : m_type( LAYER_NONE ), m_blendFunc( BLEND_ONE, BLEND_ZERO ), m_clampToB } }; -std::list g_shaderFilenames; +std::list g_shaderFilenames; void ParseShaderFile( Tokeniser& tokeniser, const char* filename ){ g_shaderFilenames.push_back( filename ); @@ -1355,7 +1355,7 @@ void ParseShaderFile( Tokeniser& tokeniser, const char* filename ){ tokeniser.ungetToken(); } // first token should be the path + name.. (from base) - CopiedString name; + std::string name; if ( !Tokeniser_parseShaderName( tokeniser, name ) ) { } ShaderTemplatePointer shaderTemplate( new ShaderTemplate() ); diff --git a/plugins/vfspk3/archive.cpp b/plugins/vfspk3/archive.cpp index a77b0728..ea0119f6 100644 --- a/plugins/vfspk3/archive.cpp +++ b/plugins/vfspk3/archive.cpp @@ -42,7 +42,7 @@ class DirectoryArchive : public Archive { -CopiedString m_root; +std::string m_root; public: DirectoryArchive( const char* root ) : m_root( root ){ } diff --git a/plugins/vfspk3/vfs.cpp b/plugins/vfspk3/vfs.cpp index 4ccc8b59..7e98a415 100644 --- a/plugins/vfspk3/vfs.cpp +++ b/plugins/vfspk3/vfs.cpp @@ -78,7 +78,7 @@ Archive* OpenArchive( const char* name ); struct archive_entry_t { - CopiedString name; + std::string name; Archive* archive; bool is_pakfile; }; @@ -269,12 +269,12 @@ static int string_compare_nocase_upper( const char* a, const char* b ){ class PakLess { public: -bool operator()( const CopiedString& self, const CopiedString& other ) const { +bool operator()( const std::string& self, const std::string& other ) const { return string_compare_nocase_upper( self.c_str(), other.c_str() ) > 0; } }; -typedef std::set Archives; +typedef std::set Archives; // ============================================================================= // Global functions diff --git a/radiant/brush.h b/radiant/brush.h index 0fb6ffe2..46c820bd 100644 --- a/radiant/brush.h +++ b/radiant/brush.h @@ -366,7 +366,7 @@ public: class SavedState { public: -CopiedString m_shader; +std::string m_shader; ContentsFlagsValue m_flags; SavedState( const FaceShader& faceShader ){ @@ -380,7 +380,7 @@ void exportState( FaceShader& faceShader ) const { } }; -CopiedString m_shader; +std::string m_shader; Shader* m_state; ContentsFlagsValue m_flags; FaceShaderObserverPair m_observers; diff --git a/radiant/brushmanip.cpp b/radiant/brushmanip.cpp index c49464be..de5dca55 100644 --- a/radiant/brushmanip.cpp +++ b/radiant/brushmanip.cpp @@ -809,10 +809,10 @@ void Scene_BrushGetFlags_Component_Selected( scene::Graph& graph, ContentsFlagsV class FaceGetShader { -CopiedString& m_shader; +std::string& m_shader; mutable bool m_done; public: -FaceGetShader( CopiedString& shader ) +FaceGetShader( std::string& shader ) : m_shader( shader ), m_done( false ){ } void operator()( Face& face ) const { @@ -823,7 +823,7 @@ void operator()( Face& face ) const { } }; -void Scene_BrushGetShader_Selected( scene::Graph& graph, CopiedString& shader ){ +void Scene_BrushGetShader_Selected( scene::Graph& graph, std::string& shader ){ #if 1 if ( GlobalSelectionSystem().countSelected() != 0 ) { BrushInstance* brush = Instance_getBrush( GlobalSelectionSystem().ultimateSelected() ); @@ -836,7 +836,7 @@ void Scene_BrushGetShader_Selected( scene::Graph& graph, CopiedString& shader ){ #endif } -void Scene_BrushGetShader_Component_Selected( scene::Graph& graph, CopiedString& shader ){ +void Scene_BrushGetShader_Component_Selected( scene::Graph& graph, std::string& shader ){ #if 1 if ( !g_SelectedFaceInstances.empty() ) { FaceInstance& faceInstance = g_SelectedFaceInstances.last(); diff --git a/radiant/brushmanip.h b/radiant/brushmanip.h index 06f67271..8a32865f 100644 --- a/radiant/brushmanip.h +++ b/radiant/brushmanip.h @@ -23,7 +23,7 @@ #define INCLUDED_BRUSHWRAPPER_H #include -#include "string/stringfwd.h" +#include #include "generic/callbackfwd.h" enum EBrushPrefab @@ -61,8 +61,8 @@ void Scene_BrushRotateTexdef_Selected( scene::Graph& graph, float angle ); void Scene_BrushRotateTexdef_Component_Selected( scene::Graph& graph, float angle ); void Scene_BrushSetShader_Selected( scene::Graph& graph, const char* name ); void Scene_BrushSetShader_Component_Selected( scene::Graph& graph, const char* name ); -void Scene_BrushGetShader_Selected( scene::Graph& graph, CopiedString& shader ); -void Scene_BrushGetShader_Component_Selected( scene::Graph& graph, CopiedString& shader ); +void Scene_BrushGetShader_Selected( scene::Graph& graph, std::string& shader ); +void Scene_BrushGetShader_Component_Selected( scene::Graph& graph, std::string& shader ); void Scene_BrushFindReplaceShader( scene::Graph& graph, const char* find, const char* replace ); void Scene_BrushFindReplaceShader_Selected( scene::Graph& graph, const char* find, const char* replace ); void Scene_BrushFindReplaceShader_Component_Selected( scene::Graph& graph, const char* find, const char* replace ); diff --git a/radiant/build.cpp b/radiant/build.cpp index 3ea279da..779ab6bc 100644 --- a/radiant/build.cpp +++ b/radiant/build.cpp @@ -29,7 +29,7 @@ #include "mainframe.h" -typedef std::map Variables; +typedef std::map Variables; Variables g_build_variables; void build_clear_variables(){ @@ -62,7 +62,7 @@ virtual void exportXML( XMLImporter& importer ) = 0; class VariableString : public Evaluatable { -CopiedString m_string; +std::string m_string; public: VariableString() : m_string(){ } @@ -293,7 +293,7 @@ void popElement( const char* name ){ } }; -typedef std::pair BuildPair; +typedef std::pair BuildPair; #define SEPARATOR_STRING "-" static bool is_separator( const BuildPair &p ){ if ( !string_equal( p.first.c_str(), SEPARATOR_STRING ) ) { @@ -350,7 +350,7 @@ Build::iterator Build_find( Build& build, std::size_t index ){ return i; } -typedef std::map Tools; +typedef std::map Tools; class ProjectXMLConstructor : public XMLElementParser { @@ -410,7 +410,7 @@ void popElement( const char* name ){ class RootXMLConstructor : public XMLElementParser { -CopiedString m_elementName; +std::string m_elementName; XMLElementParser& m_parser; SkipAllParser m_skip; Version m_version; @@ -950,7 +950,7 @@ GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi namespace { -CopiedString g_buildMenu; +std::string g_buildMenu; } void LoadBuildMenu(); diff --git a/radiant/commands.cpp b/radiant/commands.cpp index f608ea49..067a1258 100644 --- a/radiant/commands.cpp +++ b/radiant/commands.cpp @@ -34,7 +34,7 @@ #include "gtkmisc.h" typedef std::pair ShortcutValue; // accelerator, isRegistered -typedef std::map Shortcuts; +typedef std::map Shortcuts; void Shortcuts_foreach( Shortcuts& shortcuts, CommandVisitor& visitor ){ for ( Shortcuts::iterator i = shortcuts.begin(); i != shortcuts.end(); ++i ) @@ -69,7 +69,7 @@ void GlobalShortcuts_reportUnregistered(){ } } -typedef std::map Commands; +typedef std::map Commands; Commands g_commands; @@ -84,7 +84,7 @@ const Command& GlobalCommands_find( const char* command ){ return ( *i ).second; } -typedef std::map Toggles; +typedef std::map Toggles; Toggles g_toggles; @@ -99,7 +99,7 @@ const Toggle& GlobalToggles_find( const char* name ){ return ( *i ).second; } -typedef std::map KeyEvents; +typedef std::map KeyEvents; KeyEvents g_keyEvents; diff --git a/radiant/dialog.cpp b/radiant/dialog.cpp index e98cac92..087d0439 100644 --- a/radiant/dialog.cpp +++ b/radiant/dialog.cpp @@ -139,7 +139,7 @@ typedef ImportExport BoolImportExport; typedef ImportExport IntImportExport; typedef ImportExport SizeImportExport; typedef ImportExport FloatImportExport; -typedef ImportExport StringImportExport; +typedef ImportExport StringImportExport; @@ -401,7 +401,7 @@ void Dialog::AddDialogData( GtkToggleButton& widget, bool& data ){ void Dialog::AddDialogData( GtkRadioButton& widget, int& data ){ AddData( m_data ).apply( widget, data ); } -void Dialog::AddDialogData( GtkEntry& widget, CopiedString& data ){ +void Dialog::AddDialogData( GtkEntry& widget, std::string& data ){ AddData( m_data ).apply( widget, data ); } void Dialog::AddDialogData( GtkEntry& widget, int& data ){ @@ -627,7 +627,7 @@ GtkWidget* Dialog::addPathEntry( GtkWidget* vbox, const char* name, bool browse_ return GTK_WIDGET( row ); } -GtkWidget* Dialog::addPathEntry( GtkWidget* vbox, const char* name, CopiedString& data, bool browse_directory ){ +GtkWidget* Dialog::addPathEntry( GtkWidget* vbox, const char* name, std::string& data, bool browse_directory ){ return addPathEntry( vbox, name, browse_directory, StringImportCallback( StringImportCaller( data ) ), StringExportCallback( StringExportCaller( data ) ) ); } diff --git a/radiant/dialog.h b/radiant/dialog.h index 61e1580d..3ed229e6 100644 --- a/radiant/dialog.h +++ b/radiant/dialog.h @@ -75,14 +75,14 @@ inline void FloatExport( float& self, const FloatImportCallback& importCallback typedef ReferenceCaller1 FloatExportCaller; -inline void StringImport( CopiedString& self, const char* value ){ +inline void StringImport( std::string& self, const char* value ){ self = value; } -typedef ReferenceCaller1 StringImportCaller; -inline void StringExport( CopiedString& self, const StringImportCallback& importCallback ){ +typedef ReferenceCaller1 StringImportCaller; +inline void StringExport( std::string& self, const StringImportCallback& importCallback ){ importCallback( self.c_str() ); } -typedef ReferenceCaller1 StringExportCaller; +typedef ReferenceCaller1 StringExportCaller; class DLG_DATA @@ -162,7 +162,7 @@ GtkWidget* addEntry( GtkWidget* vbox, const char* name, float& data ){ return addFloatEntry( vbox, name, FloatImportCaller( data ), FloatExportCaller( data ) ); } GtkWidget* addPathEntry( GtkWidget* vbox, const char* name, bool browse_directory, const StringImportCallback& importCallback, const StringExportCallback& exportCallback ); -GtkWidget* addPathEntry( GtkWidget* vbox, const char* name, CopiedString& data, bool directory ); +GtkWidget* addPathEntry( GtkWidget* vbox, const char* name, std::string& data, bool directory ); GtkWidget* addSpinner( GtkWidget* vbox, const char* name, int& data, double value, double lower, double upper ); GtkWidget* addSpinner( GtkWidget* vbox, const char* name, double value, double lower, double upper, const IntImportCallback& importCallback, const IntExportCallback& exportCallback ); GtkWidget* addSpinner( GtkWidget* vbox, const char* name, double value, double lower, double upper, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback ); @@ -182,7 +182,7 @@ void AddIntComboData( GtkComboBox& object, const IntImportCallback& importCallba void AddDialogData( GtkToggleButton& object, bool& data ); void AddDialogData( GtkRadioButton& object, int& data ); -void AddDialogData( GtkEntry& object, CopiedString& data ); +void AddDialogData( GtkEntry& object, std::string& data ); void AddDialogData( GtkEntry& object, int& data ); void AddDialogData( GtkEntry& object, std::size_t& data ); void AddDialogData( GtkEntry& object, float& data ); diff --git a/radiant/eclass.cpp b/radiant/eclass.cpp index c74c7b72..741cdcf8 100644 --- a/radiant/eclass.cpp +++ b/radiant/eclass.cpp @@ -46,7 +46,7 @@ typedef std::map EntityClasses; EntityClasses g_entityClasses; EntityClass *eclass_bad = 0; //char eclass_directory[1024]; -typedef std::map ListAttributeTypes; +typedef std::map ListAttributeTypes; ListAttributeTypes g_listTypes; } @@ -168,12 +168,12 @@ void operator()( const char* name ) const { struct PathLess { - bool operator()( const CopiedString& path, const CopiedString& other ) const { + bool operator()( const std::string& path, const std::string& other ) const { return path_less( path.c_str(), other.c_str() ); } }; -typedef std::map Paths; +typedef std::map Paths; class PathsInsert { diff --git a/radiant/eclass_def.cpp b/radiant/eclass_def.cpp index 8637b480..f4374342 100644 --- a/radiant/eclass_def.cpp +++ b/radiant/eclass_def.cpp @@ -155,7 +155,7 @@ const char* Get_COM_Token(){ const char *debugname; -void setSpecialLoad( EntityClass *e, const char* pWhat, CopiedString& p ){ +void setSpecialLoad( EntityClass *e, const char* pWhat, std::string& p ){ // Hydra: removed some amazingly bad cstring usage, whoever wrote that // needs to be taken out and shot. diff --git a/radiant/eclass_doom3.cpp b/radiant/eclass_doom3.cpp index 6c4bb022..f71a917e 100644 --- a/radiant/eclass_doom3.cpp +++ b/radiant/eclass_doom3.cpp @@ -105,7 +105,7 @@ bool EntityClassDoom3_parseString( Tokeniser& tokeniser, const char*& s ){ return true; } -bool EntityClassDoom3_parseString( Tokeniser& tokeniser, CopiedString& s ){ +bool EntityClassDoom3_parseString( Tokeniser& tokeniser, std::string& s ){ const char* token = tokeniser.getToken(); PARSE_RETURN_FALSE_IF_FAIL( token != 0 ); s = token; @@ -152,16 +152,16 @@ class Model { public: bool m_resolved; -CopiedString m_mesh; -CopiedString m_skin; -CopiedString m_parent; -typedef std::map Anims; +std::string m_mesh; +std::string m_skin; +std::string m_parent; +typedef std::map Anims; Anims m_anims; Model() : m_resolved( false ){ } }; -typedef std::map Models; +typedef std::map Models; Models g_models; @@ -241,7 +241,7 @@ bool EntityClassDoom3_parseModel( Tokeniser& tokeniser ){ } } else if ( string_equal( parameter, "anim" ) ) { - CopiedString animName; + std::string animName; PARSE_RETURN_FALSE_IF_FAIL( EntityClassDoom3_parseString( tokeniser, animName ) ); const char* animFile; PARSE_RETURN_FALSE_IF_FAIL( EntityClassDoom3_parseString( tokeniser, animFile ) ); @@ -319,7 +319,7 @@ static bool EntityClass_parse( EntityClass& entityClass, Tokeniser& tokeniser ){ StringOutputStream usage( 256 ); StringOutputStream description( 256 ); - CopiedString* currentDescription = 0; + std::string* currentDescription = 0; StringOutputStream* currentString = 0; for (;; ) @@ -328,7 +328,7 @@ static bool EntityClass_parse( EntityClass& entityClass, Tokeniser& tokeniser ){ PARSE_RETURN_FALSE_IF_FAIL( EntityClassDoom3_parseString( tokeniser, key ) ); const char* last = string_findFirstSpaceOrTab( key ); - CopiedString first( StringRange( key, last ) ); + std::string first( StringRange( key, last ) ); if ( !string_empty( last ) ) { last = string_findFirstNonSpaceOrTab( last ); @@ -501,7 +501,7 @@ static bool EntityClass_parse( EntityClass& entityClass, Tokeniser& tokeniser ){ // end ignore prey entity keys else { - CopiedString tmp( key ); + std::string tmp( key ); ASSERT_MESSAGE( !string_equal_n( key, "editor_", 7 ), "unsupported editor key: " << makeQuoted( key ) ); EntityClassAttribute& attribute = EntityClass_insertAttribute( entityClass, key ).second; attribute.m_type = "string"; @@ -598,7 +598,7 @@ bool EntityClassDoom3_parse( TextInputStream& inputStream, const char* filename if ( blockType == 0 ) { return true; } - CopiedString tmp( blockType ); + std::string tmp( blockType ); if ( !EntityClassDoom3_parseBlock( tokeniser, tmp.c_str() ) ) { globalErrorStream() << GlobalFileSystem().findFile( filename ) << filename << ":" << (unsigned int)tokeniser.getLine() << ": " << tmp.c_str() << " parse failed, skipping rest of file\n"; return false; diff --git a/radiant/eclass_fgd.cpp b/radiant/eclass_fgd.cpp index 7b877915..e2649113 100644 --- a/radiant/eclass_fgd.cpp +++ b/radiant/eclass_fgd.cpp @@ -45,7 +45,7 @@ EntityClasses g_EntityClassFGD_classes; typedef std::map BaseClasses; BaseClasses g_EntityClassFGD_bases; EntityClass *g_EntityClassFGD_bad = 0; -typedef std::map ListAttributeTypes; +typedef std::map ListAttributeTypes; ListAttributeTypes g_listTypesFGD; } @@ -93,7 +93,7 @@ inline bool EntityClassFGD_parseToken( Tokeniser& tokeniser, const char* token ) #define PARSE_ERROR "error parsing entity class definition" -void EntityClassFGD_parseSplitString( Tokeniser& tokeniser, CopiedString& string ){ +void EntityClassFGD_parseSplitString( Tokeniser& tokeniser, std::string& string ){ StringOutputStream buffer( 256 ); for (;; ) { @@ -249,7 +249,7 @@ void EntityClassFGD_parseClass( Tokeniser& tokeniser, bool fixedsize, bool isBas for (;; ) { - CopiedString key = tokeniser.getToken(); + std::string key = tokeniser.getToken(); if ( string_equal( key.c_str(), "]" ) ) { tokeniser.nextLine(); break; @@ -265,7 +265,7 @@ void EntityClassFGD_parseClass( Tokeniser& tokeniser, bool fixedsize, bool isBas ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, ")" ), PARSE_ERROR ); const char* descriptionSeparator = tokeniser.getToken(); if ( string_equal( descriptionSeparator, ":" ) ) { - CopiedString description; + std::string description; EntityClassFGD_parseSplitString( tokeniser, description ); } else @@ -278,7 +278,7 @@ void EntityClassFGD_parseClass( Tokeniser& tokeniser, bool fixedsize, bool isBas } ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "(" ), PARSE_ERROR ); - CopiedString type = tokeniser.getToken(); + std::string type = tokeniser.getToken(); ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, ")" ), PARSE_ERROR ); if ( string_equal_nocase( type.c_str(), "flags" ) ) { @@ -375,7 +375,7 @@ void EntityClassFGD_parseClass( Tokeniser& tokeniser, bool fixedsize, bool isBas } else { - CopiedString tmp( value ); + std::string tmp( value ); ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, ":" ), PARSE_ERROR ); const char* name = tokeniser.getToken(); listType.push_back( name, tmp.c_str() ); diff --git a/radiant/eclass_xml.cpp b/radiant/eclass_xml.cpp index 687d4adf..db60afd6 100644 --- a/radiant/eclass_xml.cpp +++ b/radiant/eclass_xml.cpp @@ -250,7 +250,7 @@ bool attributeSupported( const char* name ){ || string_equal( name, "integer2" ); } -typedef std::map ListAttributeTypes; +typedef std::map ListAttributeTypes; bool listAttributeSupported( ListAttributeTypes& listTypes, const char* name ){ return listTypes.find( name ) != listTypes.end(); diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index 859050ec..550353d1 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -87,7 +87,7 @@ GtkEntry* numeric_entry_new(){ namespace { -typedef std::map KeyValues; +typedef std::map KeyValues; KeyValues g_selectedKeyValues; KeyValues g_selectedDefaultKeyValues; } @@ -126,7 +126,7 @@ virtual void release() = 0; class BooleanAttribute : public EntityAttribute { -CopiedString m_key; +std::string m_key; GtkCheckButton* m_check; static gboolean toggled( GtkWidget *widget, BooleanAttribute* self ){ @@ -174,7 +174,7 @@ typedef MemberCaller UpdateCaller; class StringAttribute : public EntityAttribute { -CopiedString m_key; +std::string m_key; GtkEntry* m_entry; NonModalEntry m_nonModal; public: @@ -225,7 +225,7 @@ ShaderAttribute( const char* key ) : StringAttribute( key ){ class ModelAttribute : public EntityAttribute { -CopiedString m_key; +std::string m_key; BrowsedPathEntry m_entry; NonModalEntry m_nonModal; public: @@ -288,7 +288,7 @@ const char* browse_sound( GtkWidget* parent ){ class SoundAttribute : public EntityAttribute { -CopiedString m_key; +std::string m_key; BrowsedPathEntry m_entry; NonModalEntry m_nonModal; public: @@ -333,7 +333,7 @@ inline double angle_normalised( double angle ){ class AngleAttribute : public EntityAttribute { -CopiedString m_key; +std::string m_key; GtkEntry* m_entry; NonModalEntry m_nonModal; public: @@ -381,7 +381,7 @@ const String buttons[] = { "up", "down", "z-axis" }; class DirectionAttribute : public EntityAttribute { -CopiedString m_key; +std::string m_key; GtkEntry* m_entry; NonModalEntry m_nonModal; RadioHBox m_radio; @@ -479,7 +479,7 @@ typedef BasicVector3 DoubleVector3; class AnglesAttribute : public EntityAttribute { -CopiedString m_key; +std::string m_key; AnglesEntry m_angles; NonModalEntry m_nonModal; GtkBox* m_hbox; @@ -566,7 +566,7 @@ Vector3Entry() : m_x( 0 ), m_y( 0 ), m_z( 0 ){ class Vector3Attribute : public EntityAttribute { -CopiedString m_key; +std::string m_key; Vector3Entry m_vector3; NonModalEntry m_nonModal; GtkBox* m_hbox; @@ -666,7 +666,7 @@ void setActive( GtkComboBox* combo, int value ){ class ListAttribute : public EntityAttribute { -CopiedString m_key; +std::string m_key; GtkComboBox* m_combo; NonModalComboBox m_nonModal; const ListAttributeType& m_type; @@ -767,7 +767,7 @@ GetKeyValueVisitor( KeyValues& keyvalues ) } void visit( const char* key, const char* value ){ - m_keyvalues.insert( KeyValues::value_type( CopiedString( key ), CopiedString( value ) ) ); + m_keyvalues.insert( KeyValues::value_type( std::string( key ), std::string( value ) ) ); } }; @@ -809,7 +809,7 @@ public: } const char* keyvalues_valueforkey( KeyValues& keyvalues, const char* key ){ - KeyValues::iterator i = keyvalues.find( CopiedString( key ) ); + KeyValues::iterator i = keyvalues.find( std::string( key ) ); if ( i != keyvalues.end() ) { return ( *i ).second.c_str(); } @@ -1052,8 +1052,8 @@ void EntityInspector_updateKeyValues(){ // save current key/val pair around filling epair box // row_select wipes it and sets to first in list - CopiedString strKey( gtk_entry_get_text( g_entityKeyEntry ) ); - CopiedString strVal( gtk_entry_get_text( g_entityValueEntry ) ); + std::string strKey( gtk_entry_get_text( g_entityKeyEntry ) ); + std::string strVal( gtk_entry_get_text( g_entityValueEntry ) ); gtk_list_store_clear( store ); // Walk through list and add pairs diff --git a/radiant/environment.cpp b/radiant/environment.cpp index 232b3582..a15b66ee 100644 --- a/radiant/environment.cpp +++ b/radiant/environment.cpp @@ -157,8 +157,8 @@ void gamedetect(){ namespace { -CopiedString home_path; -CopiedString app_path; +std::string home_path; +std::string app_path; } const char* environment_get_home_path(){ diff --git a/radiant/filetypes.cpp b/radiant/filetypes.cpp index cfb3cc6f..1fb9d8b5 100644 --- a/radiant/filetypes.cpp +++ b/radiant/filetypes.cpp @@ -48,12 +48,12 @@ struct filetype_copy_t bool m_can_import; bool m_can_save; private: - CopiedString m_moduleName; - CopiedString m_name; - CopiedString m_pattern; + std::string m_moduleName; + std::string m_name; + std::string m_pattern; }; typedef std::vector filetype_list_t; -std::map m_typelists; +std::map m_typelists; public: RadiantFileTypeRegistry(){ addType( "*", "*", filetype_t( "All Files", "*.*" ) ); diff --git a/radiant/findtexturedialog.cpp b/radiant/findtexturedialog.cpp index 83ac42f0..e2cf2673 100644 --- a/radiant/findtexturedialog.cpp +++ b/radiant/findtexturedialog.cpp @@ -77,8 +77,8 @@ void destroyWindow(){ bool m_bSelectedOnly; -CopiedString m_strFind; -CopiedString m_strReplace; +std::string m_strFind; +std::string m_strReplace; }; FindTextureDialog g_FindTextureDialog; diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index e35b467e..5a887b29 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -923,7 +923,7 @@ EMessageBoxReturn DoLightIntensityDlg( int *intensity ){ // ============================================================================= // Add new shader tag dialog -EMessageBoxReturn DoShaderTagDlg( CopiedString* tag, const char* title ){ +EMessageBoxReturn DoShaderTagDlg( std::string* tag, const char* title ){ ModalDialog dialog; GtkEntry* textentry; ModalDialogButton ok_button( dialog, eIDOK ); @@ -1047,7 +1047,7 @@ bool g_TextEditor_useWin32Editor = true; #else // custom shader editor bool g_TextEditor_useCustomEditor = false; -CopiedString g_TextEditor_editorCommand( "" ); +std::string g_TextEditor_editorCommand( "" ); #endif void DoTextEditor( const char* filename, int cursorpos ){ diff --git a/radiant/gtkdlgs.h b/radiant/gtkdlgs.h index 05f8b8b9..8f079072 100644 --- a/radiant/gtkdlgs.h +++ b/radiant/gtkdlgs.h @@ -35,7 +35,7 @@ #include "string/string.h" EMessageBoxReturn DoLightIntensityDlg( int *intensity ); -EMessageBoxReturn DoShaderTagDlg( CopiedString *tag, const char* title ); +EMessageBoxReturn DoShaderTagDlg( std::string *tag, const char* title ); EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, const char* title ); EMessageBoxReturn DoTextureLayout( float *fx, float *fy ); void DoTextEditor( const char* filename, int cursorpos ); @@ -50,9 +50,9 @@ void DoAbout(); #ifdef WIN32 extern bool g_TextEditor_useWin32Editor; #else -#include "string/stringfwd.h" +#include extern bool g_TextEditor_useCustomEditor; -extern CopiedString g_TextEditor_editorCommand; +extern std::string g_TextEditor_editorCommand; #endif diff --git a/radiant/help.cpp b/radiant/help.cpp index d5319f30..d5157426 100644 --- a/radiant/help.cpp +++ b/radiant/help.cpp @@ -41,13 +41,13 @@ */ namespace { -std::list mHelpURLs; +std::list mHelpURLs; } /*! needed for hooking in Gtk+ */ -void HandleHelpCommand( CopiedString& str ){ +void HandleHelpCommand( std::string& str ){ OpenURL( str.c_str() ); } @@ -71,7 +71,7 @@ void process_xlink( const char* filename, const char *menu_name, const char *bas { if ( !strcmp( (const char*)pNode->name, "item" ) ) { // process the URL - CopiedString url; + std::string url; xmlChar* prop = xmlGetProp( pNode, reinterpret_cast( "url" ) ); ASSERT_NOTNULL( prop ); @@ -93,7 +93,7 @@ void process_xlink( const char* filename, const char *menu_name, const char *bas prop = xmlGetProp( pNode, reinterpret_cast( "name" ) ); ASSERT_NOTNULL( prop ); - create_menu_item_with_mnemonic( menu_in_menu, reinterpret_cast( prop ), ReferenceCaller( mHelpURLs.back() ) ); + create_menu_item_with_mnemonic( menu_in_menu, reinterpret_cast( prop ), ReferenceCaller( mHelpURLs.back() ) ); xmlFree( prop ); } pNode = pNode->next; diff --git a/radiant/main.cpp b/radiant/main.cpp index c669aba4..78d10c89 100644 --- a/radiant/main.cpp +++ b/radiant/main.cpp @@ -39,7 +39,7 @@ \link os/path.h os/path.h \endlink - Path manipulation for radiant's standard path format \n \link os/file.h os/file.h \endlink - OS file-system access. \n - ::CopiedString - automatic string memory management \n + ::std::string - automatic string memory management \n Array - automatic array memory management \n HashTable - generic hashtable, similar to std::hash_map \n diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 7e04d46a..14f131f5 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -305,7 +305,7 @@ void HomePaths_Destroy(){ // Engine Path -CopiedString g_strEnginePath; +std::string g_strEnginePath; ModuleObservers g_enginePathObservers; std::size_t g_enginepath_unrealised = 1; @@ -367,7 +367,7 @@ void setEnginePath( const char* path ){ // App Path -CopiedString g_strAppPath; ///< holds the full path of the executable +std::string g_strAppPath; ///< holds the full path of the executable const char* AppPath_get(){ return g_strAppPath.c_str(); @@ -375,7 +375,7 @@ const char* AppPath_get(){ /// the path to the local rc-dir const char* LocalRcPath_get( void ){ - static CopiedString rc_path; + static std::string rc_path; if ( rc_path.empty() ) { StringOutputStream stream( 256 ); stream << GlobalRadiant().getSettingsPath() << g_pGameDescription->mGameFile.c_str() << "/"; @@ -386,7 +386,7 @@ const char* LocalRcPath_get( void ){ /// directory for temp files /// NOTE: on *nix this is were we check for .pid -CopiedString g_strSettingsPath; +std::string g_strSettingsPath; const char* SettingsPath_get(){ return g_strSettingsPath.c_str(); } @@ -401,16 +401,16 @@ const char* SettingsPath_get(){ [GameToolsPath]/modules and also q3map, bspc */ -CopiedString g_strGameToolsPath; ///< this is set by g_GamesDialog +std::string g_strGameToolsPath; ///< this is set by g_GamesDialog const char* GameToolsPath_get(){ return g_strGameToolsPath.c_str(); } -void EnginePathImport( CopiedString& self, const char* value ){ +void EnginePathImport( std::string& self, const char* value ){ setEnginePath( value ); } -typedef ReferenceCaller1 EnginePathImportCaller; +typedef ReferenceCaller1 EnginePathImportCaller; void Paths_constructPreferences( PreferencesPage& page ){ page.appendPathEntry( "Engine Path", true, @@ -457,8 +457,8 @@ void EnginePath_verify(){ namespace { -CopiedString g_gamename; -CopiedString g_gamemode; +std::string g_gamename; +std::string g_gamemode; ModuleObservers g_gameNameObservers; ModuleObservers g_gameModeObservers; } @@ -1678,7 +1678,7 @@ bool MainFrame_isActiveApp(){ return false; } -typedef std::list StringStack; +typedef std::list StringStack; StringStack g_wait_stack; WaitDialog g_wait; @@ -3059,7 +3059,7 @@ void MainFrame::UpdateStatusText(){ m_idleRedrawStatusText.queueDraw(); } -void MainFrame::SetStatusText( CopiedString& status_text, const char* pText ){ +void MainFrame::SetStatusText( std::string& status_text, const char* pText ){ status_text = pText; UpdateStatusText(); } diff --git a/radiant/mainframe.h b/radiant/mainframe.h index 0b008a6b..95d61670 100644 --- a/radiant/mainframe.h +++ b/radiant/mainframe.h @@ -62,11 +62,11 @@ MainFrame(); GtkWindow* m_window; -CopiedString m_command_status; -CopiedString m_position_status; -CopiedString m_brushcount_status; -CopiedString m_texture_status; -CopiedString m_grid_status; +std::string m_command_status; +std::string m_position_status; +std::string m_brushcount_status; +std::string m_texture_status; +std::string m_grid_status; private: void Create(); @@ -101,7 +101,7 @@ bool IsSleeping(){ } void OnSleep(); -void SetStatusText( CopiedString& status_text, const char* pText ); +void SetStatusText( std::string& status_text, const char* pText ); void UpdateStatusText(); void RedrawStatusText(); typedef MemberCaller RedrawStatusTextCaller; @@ -202,15 +202,15 @@ void Radiant_detachEnginePathObserver( ModuleObserver& observer ); void Radiant_attachGameToolsPathObserver( ModuleObserver& observer ); void Radiant_detachGameToolsPathObserver( ModuleObserver& observer ); -extern CopiedString g_strEnginePath; +extern std::string g_strEnginePath; void EnginePath_verify(); const char* EnginePath_get(); const char* QERApp_GetGamePath(); -extern CopiedString g_strAppPath; +extern std::string g_strAppPath; const char* AppPath_get(); -extern CopiedString g_strSettingsPath; +extern std::string g_strSettingsPath; const char* SettingsPath_get(); const char* LocalRcPath_get( void ); @@ -218,7 +218,7 @@ const char* LocalRcPath_get( void ); const char* const g_pluginsDir = "plugins/"; ///< name of plugins directory, always sub-directory of toolspath const char* const g_modulesDir = "modules/"; ///< name of modules directory, always sub-directory of toolspath -extern CopiedString g_strGameToolsPath; +extern std::string g_strGameToolsPath; const char* GameToolsPath_get(); void Radiant_Initialise(); diff --git a/radiant/map.cpp b/radiant/map.cpp index fae78de3..44633afa 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -90,7 +90,7 @@ MapModules& ReferenceAPI_getMapModules(); class NameObserver { UniqueNames& m_names; -CopiedString m_name; +std::string m_name; void construct(){ if ( !empty() ) { @@ -161,7 +161,7 @@ void makeUnique( const char* name, const NameCallback& setName ) const { void mergeNames( const BasicNamespace& other ) const { typedef std::list SetNameCallbacks; - typedef std::map NameGroups; + typedef std::map NameGroups; NameGroups groups; UniqueNames uniqueNames( other.m_uniqueNames ); @@ -284,7 +284,7 @@ void Map_SetWorldspawn( Map& map, scene::Node* node ); class Map : public ModuleObserver { public: -CopiedString m_name; +std::string m_name; Resource* m_resource; bool m_valid; @@ -734,7 +734,7 @@ scene::Node& Node_Clone( scene::Node& node ){ } -typedef std::map EntityBreakdown; +typedef std::map EntityBreakdown; class EntityBreakdownWalker : public scene::Graph::Walker { @@ -1768,7 +1768,7 @@ void NewMap(){ } } -CopiedString g_mapsPath; +std::string g_mapsPath; const char* getMapsPath(){ return g_mapsPath.c_str(); @@ -2142,7 +2142,7 @@ MapModuleObserver g_MapModuleObserver; #include "preferencesystem.h" -CopiedString g_strLastMap; +std::string g_strLastMap; bool g_bLoadLastMap = false; void Map_Construct(){ diff --git a/radiant/map.h b/radiant/map.h index a359d461..36be62b5 100644 --- a/radiant/map.h +++ b/radiant/map.h @@ -25,7 +25,7 @@ #include "iscenegraph.h" #include "generic/callback.h" #include "signal/signalfwd.h" -#include "string/stringfwd.h" +#include class Map; extern Map g_map; @@ -149,7 +149,7 @@ void Map_Traverse( scene::Node& root, const scene::Traversable::Walker& walker ) void SelectBrush( int entitynum, int brushnum ); -extern CopiedString g_strLastMap; +extern std::string g_strLastMap; extern bool g_bLoadLastMap; void Map_Construct(); diff --git a/radiant/mru.cpp b/radiant/mru.cpp index cb833010..a30de609 100644 --- a/radiant/mru.cpp +++ b/radiant/mru.cpp @@ -38,7 +38,7 @@ namespace { GtkMenuItem *MRU_items[MRU_MAX]; std::size_t MRU_used; -typedef CopiedString MRU_filename_t; +typedef std::string MRU_filename_t; MRU_filename_t MRU_filenames[MRU_MAX]; typedef const char* MRU_key_t; MRU_key_t MRU_keys[MRU_MAX] = { "File0", "File1", "File2", "File3" }; diff --git a/radiant/patch.h b/radiant/patch.h index a1f1d272..cadb0e13 100644 --- a/radiant/patch.h +++ b/radiant/patch.h @@ -392,7 +392,7 @@ void release(){ } std::size_t m_width, m_height; -CopiedString m_shader; +std::string m_shader; PatchControlArray m_ctrl; bool m_patchDef3; std::size_t m_subdivisions_x; @@ -414,7 +414,7 @@ scene::Node* m_node; AABB m_aabb_local; // local bbox -CopiedString m_shader; +std::string m_shader; Shader* m_state; std::size_t m_width; diff --git a/radiant/patchdialog.cpp b/radiant/patchdialog.cpp index 73639e54..29d8d195 100644 --- a/radiant/patchdialog.cpp +++ b/radiant/patchdialog.cpp @@ -222,7 +222,7 @@ WindowPositionTracker m_position_tracker; Patch *m_Patch; -CopiedString m_strName; +std::string m_strName; float m_fS; float m_fT; float m_fX; diff --git a/radiant/patchmanip.cpp b/radiant/patchmanip.cpp index 4dd03828..a2ab39ee 100644 --- a/radiant/patchmanip.cpp +++ b/radiant/patchmanip.cpp @@ -341,7 +341,7 @@ void Scene_PatchSetShader_Selected( scene::Graph& graph, const char* name ){ SceneChangeNotify(); } -void Scene_PatchGetShader_Selected( scene::Graph& graph, CopiedString& name ){ +void Scene_PatchGetShader_Selected( scene::Graph& graph, std::string& name ){ Patch* patch = Scene_GetUltimateSelectedVisiblePatch(); if ( patch != 0 ) { name = patch->GetShader(); diff --git a/radiant/patchmanip.h b/radiant/patchmanip.h index 47f7f224..5c776ccf 100644 --- a/radiant/patchmanip.h +++ b/radiant/patchmanip.h @@ -22,7 +22,7 @@ #if !defined ( INCLUDED_PATCHMANIP_H ) #define INCLUDED_PATCHMANIP_H -#include "string/stringfwd.h" +#include void Patch_registerCommands(); typedef struct _GtkToolbar GtkToolbar; @@ -36,7 +36,7 @@ class Graph; } void Scene_PatchSetShader_Selected( scene::Graph& graph, const char* name ); -void Scene_PatchGetShader_Selected( scene::Graph& graph, CopiedString& name ); +void Scene_PatchGetShader_Selected( scene::Graph& graph, std::string& name ); void Scene_PatchSelectByShader( scene::Graph& graph, const char* name ); void Scene_PatchFindReplaceShader( scene::Graph& graph, const char* find, const char* replace ); void Scene_PatchFindReplaceShader_Selected( scene::Graph& graph, const char* find, const char* replace ); diff --git a/radiant/pluginmanager.cpp b/radiant/pluginmanager.cpp index 30cc0c23..8d90f18e 100644 --- a/radiant/pluginmanager.cpp +++ b/radiant/pluginmanager.cpp @@ -43,10 +43,10 @@ /* plugin manager --------------------------------------- */ class CPluginSlot : public IPlugIn { -CopiedString m_menu_name; +std::string m_menu_name; const _QERPluginTable *mpTable; -std::list m_CommandStrings; -std::list m_CommandTitleStrings; +std::list m_CommandStrings; +std::list m_CommandTitleStrings; std::list m_CommandIDs; public: @@ -109,14 +109,14 @@ std::size_t CPluginSlot::getCommandCount(){ } const char* CPluginSlot::getCommand( std::size_t n ){ - std::list::iterator i = m_CommandStrings.begin(); + std::list::iterator i = m_CommandStrings.begin(); while ( n-- != 0 ) ++i; return ( *i ).c_str(); } const char* CPluginSlot::getCommandTitle( std::size_t n ){ - std::list::iterator i = m_CommandTitleStrings.begin(); + std::list::iterator i = m_CommandTitleStrings.begin(); while ( n-- != 0 ) ++i; return ( *i ).c_str(); diff --git a/radiant/preferencedictionary.h b/radiant/preferencedictionary.h index ce3f7686..ca4baab1 100644 --- a/radiant/preferencedictionary.h +++ b/radiant/preferencedictionary.h @@ -47,10 +47,10 @@ void exportString( const StringImportCallback& importer ){ } }; -typedef std::map PreferenceEntries; +typedef std::map PreferenceEntries; PreferenceEntries m_preferences; -typedef std::map PreferenceCache; +typedef std::map PreferenceCache; PreferenceCache m_cache; public: @@ -185,7 +185,7 @@ struct xml_state_t } ETag m_tag; - CopiedString m_name; + std::string m_name; StringOutputStream m_ostream; }; diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index 4209fdb3..1e2251d3 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -113,7 +113,7 @@ inline const char* xmlAttr_getValue( xmlAttrPtr attr ){ return reinterpret_cast( attr->children->content ); } -CGameDescription::CGameDescription( xmlDocPtr pDoc, const CopiedString& gameFile ){ +CGameDescription::CGameDescription( xmlDocPtr pDoc, const std::string& gameFile ){ // read the user-friendly game name xmlNodePtr pNode = pDoc->children; diff --git a/radiant/preferences.h b/radiant/preferences.h index 8793d039..b6cded4e 100644 --- a/radiant/preferences.h +++ b/radiant/preferences.h @@ -91,7 +91,7 @@ GtkWidget* appendEntry( const char* name, float& data ){ GtkWidget* appendPathEntry( const char* name, bool browse_directory, const StringImportCallback& importCallback, const StringExportCallback& exportCallback ){ return m_dialog.addPathEntry( m_vbox, name, browse_directory, importCallback, exportCallback ); } -GtkWidget* appendPathEntry( const char* name, CopiedString& data, bool directory ){ +GtkWidget* appendPathEntry( const char* name, std::string& data, bool directory ){ return m_dialog.addPathEntry( m_vbox, name, data, directory ); } GtkWidget* appendSpinner( const char* name, int& data, double value, double lower, double upper ){ @@ -165,14 +165,14 @@ typedef MemberCaller1 LatchedIntImportCall */ class CGameDescription { -typedef std::map GameDescription; +typedef std::map GameDescription; public: -CopiedString mGameFile; ///< the .game file that describes this game +std::string mGameFile; ///< the .game file that describes this game GameDescription m_gameDescription; -CopiedString mGameToolsPath; ///< the explicit path to the game-dependent modules -CopiedString mGameType; ///< the type of the engine +std::string mGameToolsPath; ///< the explicit path to the game-dependent modules +std::string mGameType; ///< the type of the engine const char* getKeyValue( const char* key ) const { GameDescription::const_iterator i = m_gameDescription.find( key ); @@ -190,7 +190,7 @@ const char* getRequiredKeyValue( const char* key ) const { return ""; } -CGameDescription( xmlDocPtr pDoc, const CopiedString &GameFile ); +CGameDescription( xmlDocPtr pDoc, const std::string &GameFile ); void Dump(); }; @@ -226,7 +226,7 @@ public: what game has been selected this is the name of the .game file */ -CopiedString m_sGameFile; +std::string m_sGameFile; /*! prompt which game to load on startup */ diff --git a/radiant/qe3.h b/radiant/qe3.h index 88ff41aa..cd76f492 100644 --- a/radiant/qe3.h +++ b/radiant/qe3.h @@ -48,11 +48,11 @@ typedef struct win32: engine full path. unix: user home full path + engine dir. */ - CopiedString m_userEnginePath; + std::string m_userEnginePath; /*! cache for m_userEnginePath + mod subdirectory. */ - CopiedString m_userGamePath; + std::string m_userGamePath; } QEGlobals_t; diff --git a/radiant/referencecache.cpp b/radiant/referencecache.cpp index ee3ab806..e4e03c40 100644 --- a/radiant/referencecache.cpp +++ b/radiant/referencecache.cpp @@ -215,7 +215,7 @@ inline hash_t path_hash( const char* path, hash_t previous = 0 ){ struct PathEqual { - bool operator()( const CopiedString& path, const CopiedString& other ) const { + bool operator()( const std::string& path, const std::string& other ) const { return path_equal( path.c_str(), other.c_str() ); } }; @@ -223,12 +223,12 @@ struct PathEqual struct PathHash { typedef hash_t hash_type; - hash_type operator()( const CopiedString& path ) const { + hash_type operator()( const std::string& path ) const { return path_hash( path.c_str() ); } }; -typedef std::pair ModelKey; +typedef std::pair ModelKey; struct ModelKeyEqual { @@ -322,16 +322,16 @@ const char* rootPath( const char* name ){ struct ModelResource : public Resource { NodeSmartReference m_model; - const CopiedString m_originalName; - CopiedString m_path; - CopiedString m_name; - CopiedString m_type; + const std::string m_originalName; + std::string m_path; + std::string m_name; + std::string m_type; ModelLoader* m_loader; ModuleObservers m_observers; std::time_t m_modified; std::size_t m_unrealised; - ModelResource( const CopiedString& name ) : + ModelResource( const std::string& name ) : m_model( g_nullModel ), m_originalName( name ), m_type( path_get_extension( name.c_str() ) ), @@ -508,7 +508,7 @@ struct ModelResource : public Resource class HashtableReferenceCache : public ReferenceCache, public ModuleObserver { -typedef HashedCache ModelReferences; +typedef HashedCache ModelReferences; ModelReferences m_references; std::size_t m_unrealised; @@ -560,10 +560,10 @@ void clear(){ Resource* capture( const char* path ){ //globalOutputStream() << "capture: \"" << path << "\"\n"; - return m_references.capture( CopiedString( path ) ).get(); + return m_references.capture( std::string( path ) ).get(); } void release( const char* path ){ - m_references.release( CopiedString( path ) ); + m_references.release( std::string( path ) ); //globalOutputStream() << "release: \"" << path << "\"\n"; } diff --git a/radiant/renderstate.cpp b/radiant/renderstate.cpp index 0c274918..1078eff5 100644 --- a/radiant/renderstate.cpp +++ b/radiant/renderstate.cpp @@ -1014,7 +1014,7 @@ void detach( ModuleObserver& observer ){ } m_observers.detach( observer ); } -void realise( const CopiedString& name ){ +void realise( const std::string& name ){ construct( name.c_str() ); if ( m_used != 0 && m_shader != 0 ) { @@ -1147,7 +1147,7 @@ public: explicit CreateOpenGLShader( OpenGLShaderCache* cache = 0 ) : m_cache( cache ){ } -OpenGLShader* construct( const CopiedString& name ){ +OpenGLShader* construct( const std::string& name ){ OpenGLShader* shader = new OpenGLShader; if ( m_cache->realised() ) { shader->realise( name ); @@ -1162,7 +1162,7 @@ void destroy( OpenGLShader* shader ){ } }; -typedef HashedCache, CreateOpenGLShader> Shaders; +typedef HashedCache, CreateOpenGLShader> Shaders; Shaders m_shaders; std::size_t m_unrealised; @@ -2010,7 +2010,7 @@ void OpenGLStateBucket::render( OpenGLState& current, unsigned int globalstate, class OpenGLStateMap : public OpenGLStateLibrary { -typedef std::map States; +typedef std::map States; States m_states; public: ~OpenGLStateMap(){ diff --git a/radiant/server.cpp b/radiant/server.cpp index 1904867b..bca6baa7 100644 --- a/radiant/server.cpp +++ b/radiant/server.cpp @@ -32,8 +32,8 @@ class RadiantModuleServer : public ModuleServer { -typedef std::pair ModuleType; -typedef std::pair ModuleKey; +typedef std::pair ModuleType; +typedef std::pair ModuleKey; typedef std::map Modules_; Modules_ m_modules; bool m_error; diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index 73312a07..ddd0bfd5 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -258,7 +258,7 @@ void SurfaceInspector_queueDraw(){ namespace { -CopiedString g_selectedShader; +std::string g_selectedShader; TextureProjection g_selectedTexdef; ContentsFlagsValue g_selectedFlags; size_t g_selectedShaderSize[2]; @@ -312,7 +312,7 @@ void SurfaceInspector_SetCurrent_FromSelected(){ g_selectedTexdef.m_brushprimit_texdef.coords[0][2] = float_mod( g_selectedTexdef.m_brushprimit_texdef.coords[0][2], (float)g_selectedShaderSize[0] ); g_selectedTexdef.m_brushprimit_texdef.coords[1][2] = float_mod( g_selectedTexdef.m_brushprimit_texdef.coords[1][2], (float)g_selectedShaderSize[1] ); - CopiedString name; + std::string name; Scene_BrushGetShader_Component_Selected( GlobalSceneGraph(), name ); if ( string_not_empty( name.c_str() ) ) { SurfaceInspector_SetSelectedShader( name.c_str() ); @@ -328,7 +328,7 @@ void SurfaceInspector_SetCurrent_FromSelected(){ Scene_BrushGetTexdef_Selected( GlobalSceneGraph(), projection ); SurfaceInspector_SetSelectedTexdef( projection ); - CopiedString name; + std::string name; Scene_BrushGetShader_Selected( GlobalSceneGraph(), name ); if ( string_empty( name.c_str() ) ) { Scene_PatchGetShader_Selected( GlobalSceneGraph(), name ); @@ -1254,12 +1254,12 @@ void SurfaceInspector::ApplyFlags(){ } -void Face_getTexture( Face& face, CopiedString& shader, TextureProjection& projection, ContentsFlagsValue& flags ){ +void Face_getTexture( Face& face, std::string& shader, TextureProjection& projection, ContentsFlagsValue& flags ){ shader = face.GetShader(); face.GetTexdef( projection ); flags = face.getShader().m_flags; } -typedef Function4 FaceGetTexture; +typedef Function4 FaceGetTexture; void Face_setTexture( Face& face, const char* shader, const TextureProjection& projection, const ContentsFlagsValue& flags ){ face.SetShader( shader ); @@ -1269,12 +1269,12 @@ void Face_setTexture( Face& face, const char* shader, const TextureProjection& p typedef Function4 FaceSetTexture; -void Patch_getTexture( Patch& patch, CopiedString& shader, TextureProjection& projection, ContentsFlagsValue& flags ){ +void Patch_getTexture( Patch& patch, std::string& shader, TextureProjection& projection, ContentsFlagsValue& flags ){ shader = patch.GetShader(); projection = TextureProjection( texdef_t(), brushprimit_texdef_t(), Vector3( 0, 0, 0 ), Vector3( 0, 0, 0 ) ); flags = ContentsFlagsValue( 0, 0, 0, false ); } -typedef Function4 PatchGetTexture; +typedef Function4 PatchGetTexture; void Patch_setTexture( Patch& patch, const char* shader, const TextureProjection& projection, const ContentsFlagsValue& flags ){ patch.SetShader( shader ); @@ -1282,7 +1282,7 @@ void Patch_setTexture( Patch& patch, const char* shader, const TextureProjection typedef Function4 PatchSetTexture; -typedef Callback3 GetTextureCallback; +typedef Callback3 GetTextureCallback; typedef Callback3 SetTextureCallback; struct Texturable @@ -1374,7 +1374,7 @@ Texturable Scene_getClosestTexturable( scene::Graph& graph, SelectionTest& test return texturable; } -bool Scene_getClosestTexture( scene::Graph& graph, SelectionTest& test, CopiedString& shader, TextureProjection& projection, ContentsFlagsValue& flags ){ +bool Scene_getClosestTexture( scene::Graph& graph, SelectionTest& test, std::string& shader, TextureProjection& projection, ContentsFlagsValue& flags ){ Texturable texturable = Scene_getClosestTexturable( graph, test ); if ( texturable.getTexture != GetTextureCallback() ) { texturable.getTexture( shader, projection, flags ); @@ -1415,7 +1415,7 @@ void TextureBrowser_SetSelectedShader( TextureBrowser& textureBrowser, const cha const char* TextureBrowser_GetSelectedShader( TextureBrowser& textureBrowser ); void Scene_copyClosestTexture( SelectionTest& test ){ - CopiedString shader; + std::string shader; if ( Scene_getClosestTexture( GlobalSceneGraph(), test, shader, g_faceTextureClipboard.m_projection, g_faceTextureClipboard.m_flags ) ) { TextureBrowser_SetSelectedShader( g_TextureBrowser, shader.c_str() ); } diff --git a/radiant/textures.cpp b/radiant/textures.cpp index b223e2ee..47200afd 100644 --- a/radiant/textures.cpp +++ b/radiant/textures.cpp @@ -321,7 +321,7 @@ class TestHashtable { public: TestHashtable(){ - HashTable strings; + HashTable strings; strings["Monkey"] = "bleh"; strings["MonkeY"] = "blah"; } @@ -331,7 +331,7 @@ const TestHashtable g_testhashtable; #endif -typedef std::pair TextureKey; +typedef std::pair TextureKey; void qtexture_realise( qtexture_t& texture, const TextureKey& key ){ texture.texture_number = 0; diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 963f694d..cf3fa3be 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -99,14 +99,14 @@ bool string_equal_start( const char* string, StringRange start ){ return string_equal_n( string, start.first, start.last - start.first ); } -typedef std::set TextureGroups; +typedef std::set TextureGroups; void TextureGroups_addWad( TextureGroups& groups, const char* archive ){ if ( extension_equal( path_get_extension( archive ), "wad" ) ) { #if 1 groups.insert( archive ); #else - CopiedString archiveBaseName( path_get_filename_start( archive ), path_get_filename_base_end( archive ) ); + std::string archiveBaseName( path_get_filename_start( archive ), path_get_filename_base_end( archive ) ); groups.insert( archiveBaseName ); #endif } @@ -118,7 +118,7 @@ void TextureGroups_addShader( TextureGroups& groups, const char* shaderName ){ if ( texture != shaderName ) { const char* last = path_remove_directory( texture ); if ( !string_empty( last ) ) { - groups.insert( CopiedString( StringRange( texture, --last ) ) ); + groups.insert( std::string( StringRange( texture, --last ) ) ); } } } @@ -214,7 +214,7 @@ int width, height; int originy; int m_nTotalHeight; -CopiedString shader; +std::string shader; GtkWindow* m_parent; GtkWidget* m_gl_widget; @@ -232,10 +232,10 @@ GtkWidget* m_tag_notebook; GtkWidget* m_search_button; GtkWidget* m_shader_info_item; -std::set m_all_tags; +std::set m_all_tags; GtkListStore* m_all_tags_list; -std::vector m_copied_tags; -std::set m_found_shaders; +std::vector m_copied_tags; +std::set m_found_shaders; ToggleItem m_hideunused_item; ToggleItem m_showshaders_item; @@ -382,7 +382,7 @@ void TextureBrowser_SetSelectedShader( TextureBrowser& textureBrowser, const cha // disable the menu item "shader info" if no shader was selected IShader* ishader = QERApp_Shader_ForName( shader ); - CopiedString filename = ishader->getShaderFileName(); + std::string filename = ishader->getShaderFileName(); if ( filename.empty() ) { if ( textureBrowser.m_shader_info_item != NULL ) { @@ -397,7 +397,7 @@ void TextureBrowser_SetSelectedShader( TextureBrowser& textureBrowser, const cha } -CopiedString g_TextureBrowser_currentDirectory; +std::string g_TextureBrowser_currentDirectory; /* ============================================================================ @@ -451,7 +451,7 @@ void Texture_NextPos( TextureBrowser& textureBrowser, TextureLayout& layout, qte } bool TextureSearch_IsShown( const char* name ){ - std::set::iterator iter; + std::set::iterator iter; iter = GlobalTextureBrowser().m_found_shaders.find( name ); @@ -463,8 +463,8 @@ bool TextureSearch_IsShown( const char* name ){ } } -CopiedString g_notex; -CopiedString g_shadernotex; +std::string g_notex; +std::string g_shadernotex; // if texture_showinuse jump over non in-use textures bool Texture_IsShown( IShader* shader, bool show_shaders, bool hideUnused ){ @@ -474,7 +474,7 @@ bool Texture_IsShown( IShader* shader, bool show_shaders, bool hideUnused ){ } if ( g_TextureBrowser_currentDirectory == "Untagged" ) { - std::set::iterator iter; + std::set::iterator iter; iter = GlobalTextureBrowser().m_found_shaders.find( shader->getName() ); @@ -677,7 +677,7 @@ class LoadShaderVisitor : public Archive::Visitor { public: void visit( const char* name ){ - IShader* shader = QERApp_Shader_ForName( CopiedString( StringRange( name, path_get_filename_base_end( name ) ) ).c_str() ); + IShader* shader = QERApp_Shader_ForName( std::string( StringRange( name, path_get_filename_base_end( name ) ) ).c_str() ); shader->DecRef(); } }; @@ -1242,7 +1242,7 @@ void BuildStoreAssignedTags( GtkListStore* store, const char* shader, TextureBro gtk_list_store_clear( store ); - std::vector assigned_tags; + std::vector assigned_tags; TagBuilder.GetShaderTags( shader, assigned_tags ); for ( size_t i = 0; i < assigned_tags.size(); i++ ) @@ -1254,11 +1254,11 @@ void BuildStoreAssignedTags( GtkListStore* store, const char* shader, TextureBro void BuildStoreAvailableTags( GtkListStore* storeAvailable, GtkListStore* storeAssigned, - const std::set& allTags, + const std::set& allTags, TextureBrowser* textureBrowser ){ GtkTreeIter iterAssigned; GtkTreeIter iterAvailable; - std::set::const_iterator iterAll; + std::set::const_iterator iterAll; gchar* tag_assigned; gtk_list_store_clear( storeAvailable ); @@ -1441,7 +1441,7 @@ void TextureGroups_constructTreeModel( TextureGroups groups, GtkTreeStore* store && next != groups.end() && string_equal_start( ( *next ).c_str(), dirRoot ) ) { gtk_tree_store_append( store, &iter, NULL ); - gtk_tree_store_set( store, &iter, 0, CopiedString( StringRange( dirName, firstUnderscore ) ).c_str(), -1 ); + gtk_tree_store_set( store, &iter, 0, std::string( StringRange( dirName, firstUnderscore ) ).c_str(), -1 ); // keep going... while ( i != groups.end() && string_equal_start( ( *i ).c_str(), dirRoot ) ) @@ -1483,7 +1483,7 @@ void TextureBrowser_constructTreeStore(){ TextureGroups groups = TextureGroups_constructTreeView(); GtkTreeStore* store = gtk_tree_store_new( 1, G_TYPE_STRING ); TextureGroups_constructTreeModel( groups, store ); - std::set::iterator iter; + std::set::iterator iter; GtkTreeModel* model = GTK_TREE_MODEL( store ); @@ -1705,7 +1705,7 @@ void TextureBrowser_assignTags(){ if ( !TagBuilder.CheckShaderTag( g_TextureBrowser.shader.c_str() ) ) { // create a custom shader/texture entry IShader* ishader = QERApp_Shader_ForName( g_TextureBrowser.shader.c_str() ); - CopiedString filename = ishader->getShaderFileName(); + std::string filename = ishader->getShaderFileName(); if ( filename.empty() ) { // it's a texture @@ -1774,7 +1774,7 @@ void TextureBrowser_buildTagList(){ GtkTreeIter treeIter; gtk_list_store_clear( g_TextureBrowser.m_all_tags_list ); - std::set::iterator iter; + std::set::iterator iter; for ( iter = g_TextureBrowser.m_all_tags.begin(); iter != g_TextureBrowser.m_all_tags.end(); ++iter ) { @@ -1831,7 +1831,7 @@ void TextureBrowser_searchTags(){ globalOutputStream() << "Found " << (unsigned int)shaders_found << " textures and shaders with " << tags_searched << "\n"; ScopeDisableScreenUpdates disableScreenUpdates( "Searching...", "Loading Textures" ); - std::set::iterator iter; + std::set::iterator iter; for ( iter = g_TextureBrowser.m_found_shaders.begin(); iter != g_TextureBrowser.m_found_shaders.end(); iter++ ) { @@ -1889,7 +1889,7 @@ void TextureBrowser_constructSearchButton(){ void TextureBrowser_checkTagFile(){ const char SHADERTAG_FILE[] = "shadertags.xml"; - CopiedString default_filename, rc_filename; + std::string default_filename, rc_filename; StringOutputStream stream( 256 ); stream << LocalRcPath_get(); @@ -2204,7 +2204,7 @@ void TextureBrowser_shaderInfo(){ } void TextureBrowser_addTag(){ - CopiedString tag; + std::string tag; EMessageBoxReturn result = DoShaderTagDlg( &tag, "Add shader tag" ); @@ -2237,7 +2237,7 @@ void TextureBrowser_renameTag(){ gtk_tree_selection_selected_foreach( selection, GtkTreeSelectionForeachFunc( TextureBrowser_selectionHelper ), &selected ); if ( g_slist_length( selected ) == 1 ) { // we only rename a single tag - CopiedString newTag; + std::string newTag; EMessageBoxReturn result = DoShaderTagDlg( &newTag, "Rename shader tag" ); if ( result == eIDOK && !newTag.empty() ) { @@ -2259,7 +2259,7 @@ void TextureBrowser_renameTag(){ TagBuilder.RenameShaderTag( oldTag, newTag.c_str() ); - g_TextureBrowser.m_all_tags.erase( (CopiedString)oldTag ); + g_TextureBrowser.m_all_tags.erase( (std::string)oldTag ); g_TextureBrowser.m_all_tags.insert( newTag ); BuildStoreAssignedTags( g_TextureBrowser.m_assigned_store, g_TextureBrowser.shader.c_str(), &g_TextureBrowser ); @@ -2301,7 +2301,7 @@ void TextureBrowser_deleteTag(){ } TagBuilder.DeleteTag( tagSelected ); - g_TextureBrowser.m_all_tags.erase( (CopiedString)tagSelected ); + g_TextureBrowser.m_all_tags.erase( (std::string)tagSelected ); BuildStoreAssignedTags( g_TextureBrowser.m_assigned_store, g_TextureBrowser.shader.c_str(), &g_TextureBrowser ); BuildStoreAvailableTags( g_TextureBrowser.m_available_store, g_TextureBrowser.m_assigned_store, g_TextureBrowser.m_all_tags, &g_TextureBrowser ); @@ -2319,10 +2319,10 @@ void TextureBrowser_copyTag(){ void TextureBrowser_pasteTag(){ IShader* ishader = QERApp_Shader_ForName( g_TextureBrowser.shader.c_str() ); - CopiedString shader = g_TextureBrowser.shader.c_str(); + std::string shader = g_TextureBrowser.shader.c_str(); if ( !TagBuilder.CheckShaderTag( shader.c_str() ) ) { - CopiedString shaderFile = ishader->getShaderFileName(); + std::string shaderFile = ishader->getShaderFileName(); if ( shaderFile.empty() ) { // it's a texture TagBuilder.AddShaderNode( shader.c_str(), CUSTOM, TEXTURE ); @@ -2405,7 +2405,7 @@ void TextureBrowser_showUntagged(){ if ( result == eIDYES ) { g_TextureBrowser.m_found_shaders.clear(); TagBuilder.GetUntagged( g_TextureBrowser.m_found_shaders ); - std::set::iterator iter; + std::set::iterator iter; ScopeDisableScreenUpdates disableScreenUpdates( "Searching untagged textures...", "Loading Textures" ); diff --git a/radiant/treemodel.cpp b/radiant/treemodel.cpp index 4d2f8238..ebd68d66 100644 --- a/radiant/treemodel.cpp +++ b/radiant/treemodel.cpp @@ -737,7 +737,7 @@ void graph_tree_model_row_changed( GraphTreeNode& node ); class GraphTreeNode { -typedef std::map, GraphTreeNode*> ChildNodes; +typedef std::map, GraphTreeNode*> ChildNodes; ChildNodes m_childnodes; public: Reference m_instance; diff --git a/radiant/undo.cpp b/radiant/undo.cpp index c12811b9..1298b6cc 100644 --- a/radiant/undo.cpp +++ b/radiant/undo.cpp @@ -110,7 +110,7 @@ void release(){ struct Operation { Snapshot m_snapshot; - CopiedString m_command; + std::string m_command; Operation( const char* command ) : m_command( command ){ diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index 61f3c478..b76e9178 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -1084,10 +1084,10 @@ void EntityClassMenu_addItem( GtkMenu* menu, const char* name ){ class EntityClassMenuInserter : public EntityClassVisitor { -typedef std::pair MenuPair; +typedef std::pair MenuPair; typedef std::vector MenuStack; MenuStack m_stack; -CopiedString m_previous; +std::string m_previous; public: EntityClassMenuInserter( GtkMenu* menu ){ m_stack.reserve( 2 ); @@ -1105,7 +1105,7 @@ void visit( EntityClass* e ){ } m_previous = e->name(); } -void pushMenu( const CopiedString& name ){ +void pushMenu( const std::string& name ){ GtkMenuItem* item = GTK_MENU_ITEM( gtk_menu_item_new_with_label( name.c_str() ) ); gtk_widget_show( GTK_WIDGET( item ) ); container_add_widget( GTK_CONTAINER( m_stack.back().first ), GTK_WIDGET( item ) ); @@ -1133,7 +1133,7 @@ void addItem( const char* name, const char* next ){ if ( m_stack.size() == 2 ) { popMenu(); } - pushMenu( CopiedString( StringRange( name, underscore ) ) ); + pushMenu( std::string( StringRange( name, underscore ) ) ); } else if ( m_stack.size() == 2 ) { popMenu();