From 0cf03bc158c4da5698b86897018997a1d45d5769 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 29 Jun 2011 22:09:10 +0000 Subject: [PATCH] untabify --- dtool/src/dtoolutil/pandaFileStreamBuf.cxx | 10 +- panda/src/audiotraits/fmodAudioManager.cxx | 4 +- panda/src/audiotraits/fmodAudioSound.cxx | 28 +- panda/src/audiotraits/fmodAudioSound.h | 6 +- panda/src/awesomium/AwMouseAndKeyboard.cxx | 16 +- panda/src/awesomium/AwMouseAndKeyboard.h | 2 +- panda/src/awesomium/WebBrowserTexture.cxx | 118 +- panda/src/awesomium/WebBrowserTexture.h | 60 +- panda/src/awesomium/awWebCore.h | 10 +- panda/src/awesomium/awWebView.h | 6 +- panda/src/awesomium/awWebViewListener.cxx | 68 +- panda/src/awesomium/awWebViewListener.h | 112 +- panda/src/collide/collisionBox.cxx | 138 +- panda/src/collide/collisionBox.h | 16 +- panda/src/display/graphicsOutput.cxx | 12 +- panda/src/display/graphicsWindowProc.cxx | 2 +- panda/src/dxml/tinyxml.h | 2630 ++++++++++---------- panda/src/egg/eggGroup.cxx | 2 +- panda/src/egg2pg/eggLoader.cxx | 2 +- panda/src/gobj/config_gobj.cxx | 12 +- panda/src/gobj/geomVertexFormat.cxx | 6 +- panda/src/gobj/texture.cxx | 6 +- panda/src/gobj/texturePool.cxx | 24 +- panda/src/grutil/ffmpegTexture.cxx | 2 +- panda/src/grutil/geoMipTerrain.I | 4 +- panda/src/grutil/geoMipTerrain.cxx | 6 +- panda/src/grutil/meshDrawer.cxx | 8 +- panda/src/movies/ffmpegVideoCursor.cxx | 4 +- panda/src/net/datagramGeneratorNet.cxx | 4 +- panda/src/pgraph/portalNode.cxx | 2 +- panda/src/pgraphnodes/shaderGenerator.cxx | 32 +- panda/src/putil/bamReader.cxx | 6 +- panda/src/putil/datagramInputFile.cxx | 4 +- panda/src/speedtree/config_speedtree.cxx | 104 +- panda/src/speedtree/speedTreeNode.h | 22 +- panda/src/speedtree/stBasicTerrain.cxx | 62 +- panda/src/speedtree/stBasicTerrain.h | 6 +- panda/src/speedtree/stTerrain.cxx | 12 +- panda/src/speedtree/stTerrain.h | 12 +- panda/src/speedtree/stTransform.I | 4 +- panda/src/tform/config_tform.cxx | 6 +- panda/src/windisplay/winGraphicsWindow.cxx | 12 +- panda/src/windisplay/winGraphicsWindow.h | 2 +- 43 files changed, 1801 insertions(+), 1803 deletions(-) diff --git a/dtool/src/dtoolutil/pandaFileStreamBuf.cxx b/dtool/src/dtoolutil/pandaFileStreamBuf.cxx index bed15ce9ec..5f662b84d0 100644 --- a/dtool/src/dtoolutil/pandaFileStreamBuf.cxx +++ b/dtool/src/dtoolutil/pandaFileStreamBuf.cxx @@ -337,11 +337,11 @@ seekoff(streamoff off, ios_seekdir dir, ios_openmode which) { #else // Posix case. { - off_t li = lseek(_fd, off, SEEK_END); - if (li == (size_t)-1) { - return -1; - } - new_pos = (size_t)li; + off_t li = lseek(_fd, off, SEEK_END); + if (li == (size_t)-1) { + return -1; + } + new_pos = (size_t)li; } #endif // _WIN32 break; diff --git a/panda/src/audiotraits/fmodAudioManager.cxx b/panda/src/audiotraits/fmodAudioManager.cxx index 60bdd5f8ad..ecbb89dbfa 100644 --- a/panda/src/audiotraits/fmodAudioManager.cxx +++ b/panda/src/audiotraits/fmodAudioManager.cxx @@ -140,8 +140,8 @@ FmodAudioManager() { result = _system->init(nchan, flags, 0); if (result == FMOD_ERR_TOOMANYCHANNELS) { fmodAudio_cat.error() - << "Value too large for fmod-number-of-sound-channels: " << nchan - << "\n"; + << "Value too large for fmod-number-of-sound-channels: " << nchan + << "\n"; } else { fmod_audio_errcheck("_system->init()", result); } diff --git a/panda/src/audiotraits/fmodAudioSound.cxx b/panda/src/audiotraits/fmodAudioSound.cxx index 33985cabb9..d652871249 100644 --- a/panda/src/audiotraits/fmodAudioSound.cxx +++ b/panda/src/audiotraits/fmodAudioSound.cxx @@ -99,7 +99,7 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) { // Get the MIDI parameters. memcpy(&sound_info, &_manager->_midi_info, sizeof(sound_info)); if (sound_info.dlsname != NULL) { - audio_debug("Using DLS file " << sound_info.dlsname); + audio_debug("Using DLS file " << sound_info.dlsname); } } @@ -115,13 +115,13 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) { file->read_file(mem_buffer, true); sound_info.length = mem_buffer.size(); if (mem_buffer.size() != 0) { - name_or_data = (const char *)&mem_buffer[0]; + name_or_data = (const char *)&mem_buffer[0]; } flags |= FMOD_OPENMEMORY; if (fmodAudio_cat.is_debug()) { - fmodAudio_cat.debug() - << "Reading " << _file_name << " into memory (" << sound_info.length - << " bytes)\n"; + fmodAudio_cat.debug() + << "Reading " << _file_name << " into memory (" << sound_info.length + << " bytes)\n"; } } else if (file->get_system_info(info)) { @@ -136,9 +136,9 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) { sound_info.length = (unsigned int)info.get_size(); flags |= FMOD_CREATESTREAM; if (fmodAudio_cat.is_debug()) { - fmodAudio_cat.debug() - << "Streaming " << _file_name << " from disk (" << name_or_data - << ", " << sound_info.fileoffset << ", " << sound_info.length << ")\n"; + fmodAudio_cat.debug() + << "Streaming " << _file_name << " from disk (" << name_or_data + << ", " << sound_info.fileoffset << ", " << sound_info.length << ")\n"; } } else { @@ -153,8 +153,8 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) { sound_info.userseek = seek_callback; flags |= FMOD_CREATESTREAM; if (fmodAudio_cat.is_debug()) { - fmodAudio_cat.debug() - << "Streaming " << _file_name << " from disk using callbacks\n"; + fmodAudio_cat.debug() + << "Streaming " << _file_name << " from disk using callbacks\n"; } #else // HAVE_THREADS && !SIMPLE_THREADS @@ -162,7 +162,7 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) { name_or_data = ""; fmodAudio_cat.warning() - << "Cannot stream " << _file_name << "; file is not literally on disk.\n"; + << "Cannot stream " << _file_name << "; file is not literally on disk.\n"; #endif } @@ -949,9 +949,9 @@ get_finished_event() const { //////////////////////////////////////////////////////////////////// FMOD_RESULT F_CALLBACK FmodAudioSound:: sound_end_callback(FMOD_CHANNEL * channel, - FMOD_CHANNEL_CALLBACKTYPE type, - void *commanddata1, - void *commanddata2) { + FMOD_CHANNEL_CALLBACKTYPE type, + void *commanddata1, + void *commanddata2) { // Fortunately, this callback is made synchronously rather than // asynchronously (it is triggered during System::update()), so we // don't have to worry about thread-related issues here. diff --git a/panda/src/audiotraits/fmodAudioSound.h b/panda/src/audiotraits/fmodAudioSound.h index 44d3417e76..9fc858e9ab 100644 --- a/panda/src/audiotraits/fmodAudioSound.h +++ b/panda/src/audiotraits/fmodAudioSound.h @@ -206,9 +206,9 @@ class EXPCL_FMOD_AUDIO FmodAudioSound : public AudioSound { static FMOD_RESULT F_CALLBACK sound_end_callback(FMOD_CHANNEL * channel, - FMOD_CHANNEL_CALLBACKTYPE type, - void *commanddata1, - void *commanddata2); + FMOD_CHANNEL_CALLBACKTYPE type, + void *commanddata1, + void *commanddata2); static FMOD_RESULT F_CALLBACK open_callback(const char *name, int unicode, unsigned int *file_size, diff --git a/panda/src/awesomium/AwMouseAndKeyboard.cxx b/panda/src/awesomium/AwMouseAndKeyboard.cxx index befd2c9bc3..258e29b8f0 100644 --- a/panda/src/awesomium/AwMouseAndKeyboard.cxx +++ b/panda/src/awesomium/AwMouseAndKeyboard.cxx @@ -31,18 +31,18 @@ void AwMouseAndKeyboard::do_transmit_data(DataGraphTraverser *trav, const DataNo if (input.has_data(_button_events_input)) { const ButtonEventList *button_events; DCAST_INTO_V(button_events, input.get_data(_button_events_input).get_ptr()); - + int num_events = button_events->get_num_events(); for (int i = 0; i < num_events; i++) { const ButtonEvent &be = button_events->get_event(i); string event_name = be._button.get_name(); - printf("Button Event! : %s with code %i and index %i ", event_name.c_str(), be._keycode, be._button.get_index()); - if(be._type == ButtonEvent::T_down) printf("down"); - if(be._type == ButtonEvent::T_repeat) printf("repeat"); - if(be._type == ButtonEvent::T_up) printf("up"); - if(be._type == ButtonEvent::T_resume_down) printf("T_resume_down"); - printf("\n"); - } + printf("Button Event! : %s with code %i and index %i ", event_name.c_str(), be._keycode, be._button.get_index()); + if(be._type == ButtonEvent::T_down) printf("down"); + if(be._type == ButtonEvent::T_repeat) printf("repeat"); + if(be._type == ButtonEvent::T_up) printf("up"); + if(be._type == ButtonEvent::T_resume_down) printf("T_resume_down"); + printf("\n"); + } } } diff --git a/panda/src/awesomium/AwMouseAndKeyboard.h b/panda/src/awesomium/AwMouseAndKeyboard.h index aacba475aa..a66e42f9f4 100644 --- a/panda/src/awesomium/AwMouseAndKeyboard.h +++ b/panda/src/awesomium/AwMouseAndKeyboard.h @@ -27,7 +27,7 @@ //////////////////////////////////////////////////////////////////// class EXPCL_PANDAAWESOMIUM AwMouseAndKeyboard : public DataNode { //member data data -protected: +protected: // inputs adn output indices... initialized in constructor int _button_events_input; int _button_events_output; diff --git a/panda/src/awesomium/WebBrowserTexture.cxx b/panda/src/awesomium/WebBrowserTexture.cxx index 9b89c5b3eb..5997064af4 100644 --- a/panda/src/awesomium/WebBrowserTexture.cxx +++ b/panda/src/awesomium/WebBrowserTexture.cxx @@ -29,11 +29,11 @@ TypeHandle WebBrowserTexture::_type_handle; WebBrowserTexture::WebBrowserTexture(const WebBrowserTexture ©): Texture(copy) { - //this kind of assumes that the previous texture - //was initialized properly - _aw_web_view = copy._aw_web_view; - _update_active = copy._update_active; - _flip_texture_active = copy._flip_texture_active; + //this kind of assumes that the previous texture + //was initialized properly + _aw_web_view = copy._aw_web_view; + _update_active = copy._update_active; + _flip_texture_active = copy._flip_texture_active; } //////////////////////////////////////////////////////////////////// @@ -47,9 +47,9 @@ Texture(name), _update_active(true), _flip_texture_active(false) { - set_web_view(aw_web_view); - set_minfilter(FT_linear); - set_magfilter(FT_linear); + set_web_view(aw_web_view); + set_minfilter(FT_linear); + set_magfilter(FT_linear); } @@ -61,7 +61,7 @@ _flip_texture_active(false) //////////////////////////////////////////////////////////////////// WebBrowserTexture::~WebBrowserTexture() { - //do nothing + //do nothing } @@ -72,7 +72,7 @@ WebBrowserTexture::~WebBrowserTexture() // destructing happens in parent texture class. //////////////////////////////////////////////////////////////////// bool WebBrowserTexture::get_keep_ram_image() const { - return true; + return true; } //////////////////////////////////////////////////////////////////// @@ -82,8 +82,8 @@ bool WebBrowserTexture::get_keep_ram_image() const { // This is essentially a sub. //////////////////////////////////////////////////////////////////// void WebBrowserTexture::do_reload_ram_image() { - // A MovieTexture should never dump its RAM image. - // Therefore, this is not needed. + // A MovieTexture should never dump its RAM image. + // Therefore, this is not needed. } //////////////////////////////////////////////////////////////////// @@ -99,7 +99,7 @@ void WebBrowserTexture::do_reload_ram_image() { // the cull traverser method to do the texture udpate. //////////////////////////////////////////////////////////////////// bool WebBrowserTexture::has_cull_callback() const { - return true; + return true; } //////////////////////////////////////////////////////////////////// @@ -111,7 +111,7 @@ bool WebBrowserTexture::has_cull_callback() const { // at the next time it is culled and rendered. //////////////////////////////////////////////////////////////////// void WebBrowserTexture::set_web_view(AwWebView* aw_web_view){ - _aw_web_view = aw_web_view; + _aw_web_view = aw_web_view; } @@ -121,7 +121,7 @@ void WebBrowserTexture::set_web_view(AwWebView* aw_web_view){ // Description: Gets the current internal AwWebView of this texture. //////////////////////////////////////////////////////////////////// AwWebView* WebBrowserTexture::get_web_view() const{ - return _aw_web_view; + return _aw_web_view; } @@ -134,7 +134,7 @@ AwWebView* WebBrowserTexture::get_web_view() const{ // active. //////////////////////////////////////////////////////////////////// void WebBrowserTexture::set_update_active(bool active_flag){ - _update_active = active_flag; + _update_active = active_flag; } @@ -145,7 +145,7 @@ void WebBrowserTexture::set_update_active(bool active_flag){ // itself every time it is rendered. //////////////////////////////////////////////////////////////////// bool WebBrowserTexture::get_update_active() const{ - return _update_active; + return _update_active; } @@ -163,7 +163,7 @@ bool WebBrowserTexture::get_update_active() const{ // coordinates or shaders. //////////////////////////////////////////////////////////////////// void WebBrowserTexture::set_flip_texture_active(bool active_flag){ - _flip_texture_active = active_flag; + _flip_texture_active = active_flag; } //////////////////////////////////////////////////////////////////// @@ -173,7 +173,7 @@ void WebBrowserTexture::set_flip_texture_active(bool active_flag){ // enabled. //////////////////////////////////////////////////////////////////// bool WebBrowserTexture::get_flip_texture_active() const { - return _flip_texture_active; + return _flip_texture_active; } @@ -186,48 +186,48 @@ bool WebBrowserTexture::get_flip_texture_active() const { // does not call the update method of AwWebCore. //////////////////////////////////////////////////////////////////// bool WebBrowserTexture::cull_callback(CullTraverser *trav, const CullTraverserData &data) const{ - //see if we are in a state where udpates can happen. else just return - if( !_update_active ) return true; - if( _aw_web_view == NULL ) return true; + //see if we are in a state where udpates can happen. else just return + if( !_update_active ) return true; + if( _aw_web_view == NULL ) return true; - //do we even need to update? - if( !_aw_web_view->is_dirty() ) return true; + //do we even need to update? + if( !_aw_web_view->is_dirty() ) return true; - //see if we're the same size, if not we need to make sure this texture - //matches the webview - if( _aw_web_view->get_width() != get_x_size() || _aw_web_view->get_height() != get_y_size() || get_texture_type() != TT_2d_texture){ - //these casts are so dirty especially when the method itself is - //labled as const. Really Texture::cull_callback should be not const - //first clean up - ((WebBrowserTexture*)this)->clear_ram_mipmap_images(); - ((WebBrowserTexture*)this)->clear_ram_image(); - //now set up the texture again - ((WebBrowserTexture*)this)->setup_2d_texture( _aw_web_view->get_width(), _aw_web_view->get_height(), T_unsigned_byte, F_rgba ); - //should be good to go at this point - } + //see if we're the same size, if not we need to make sure this texture + //matches the webview + if( _aw_web_view->get_width() != get_x_size() || _aw_web_view->get_height() != get_y_size() || get_texture_type() != TT_2d_texture){ + //these casts are so dirty especially when the method itself is + //labled as const. Really Texture::cull_callback should be not const + //first clean up + ((WebBrowserTexture*)this)->clear_ram_mipmap_images(); + ((WebBrowserTexture*)this)->clear_ram_image(); + //now set up the texture again + ((WebBrowserTexture*)this)->setup_2d_texture( _aw_web_view->get_width(), _aw_web_view->get_height(), T_unsigned_byte, F_rgba ); + //should be good to go at this point + } - //get the pointer - PTA_uchar ram_image = ((WebBrowserTexture*)this)->modify_ram_image(); - unsigned char* cp_data = ram_image.p(); - //render it - _aw_web_view->render((void*)cp_data, get_x_size()*4, 4); + //get the pointer + PTA_uchar ram_image = ((WebBrowserTexture*)this)->modify_ram_image(); + unsigned char* cp_data = ram_image.p(); + //render it + _aw_web_view->render((void*)cp_data, get_x_size()*4, 4); - if(_flip_texture_active){ - //flips the texture around... this is super slow. Really this should - //never be enabled. However beginners might find this useful - size_t width = get_x_size(); - size_t height = get_y_size(); - for(size_t i=0; i < height/2; i++){ - for(size_t j=0; j < width; j++){ - unsigned char tmp[4]; - size_t a_pos = j+width*i; - size_t b_pos = j + width*(height-i-1); - memcpy(tmp,&cp_data[4*a_pos], 4); //tmp = a - memcpy(&cp_data[4*a_pos], &cp_data[4*b_pos], 4); //a = b - memcpy(&cp_data[4*b_pos], tmp, 4); //b = tmp - } - } - } - //success - return true; + if(_flip_texture_active){ + //flips the texture around... this is super slow. Really this should + //never be enabled. However beginners might find this useful + size_t width = get_x_size(); + size_t height = get_y_size(); + for(size_t i=0; i < height/2; i++){ + for(size_t j=0; j < width; j++){ + unsigned char tmp[4]; + size_t a_pos = j+width*i; + size_t b_pos = j + width*(height-i-1); + memcpy(tmp,&cp_data[4*a_pos], 4); //tmp = a + memcpy(&cp_data[4*a_pos], &cp_data[4*b_pos], 4); //a = b + memcpy(&cp_data[4*b_pos], tmp, 4); //b = tmp + } + } + } + //success + return true; } \ No newline at end of file diff --git a/panda/src/awesomium/WebBrowserTexture.h b/panda/src/awesomium/WebBrowserTexture.h index 61d2487cee..804da0b579 100644 --- a/panda/src/awesomium/WebBrowserTexture.h +++ b/panda/src/awesomium/WebBrowserTexture.h @@ -29,53 +29,53 @@ // // The use of class means that you will have to // follow Awesomium license agreement give below -// http://www.khrona.com/products/awesomium/licensing/ +// http://www.khrona.com/products/awesomium/licensing/ //////////////////////////////////////////////////////////////////// class EXPCL_PANDAAWESOMIUM WebBrowserTexture : public Texture { protected: - AwWebView* _aw_web_view; - bool _update_active; - bool _flip_texture_active; + AwWebView* _aw_web_view; + bool _update_active; + bool _flip_texture_active; //Constructors & Destructors ------------ private: - WebBrowserTexture(const WebBrowserTexture ©); + WebBrowserTexture(const WebBrowserTexture ©); PUBLISHED: - WebBrowserTexture(const string &name, AwWebView* aw_web_view = NULL); - virtual ~WebBrowserTexture(); + WebBrowserTexture(const string &name, AwWebView* aw_web_view = NULL); + virtual ~WebBrowserTexture(); //methods -------------- protected: - bool get_keep_ram_image() const; - void do_reload_ram_image(); + bool get_keep_ram_image() const; + void do_reload_ram_image(); public: - virtual bool has_cull_callback() const; - virtual bool cull_callback(CullTraverser *trav, const CullTraverserData &data) const; + virtual bool has_cull_callback() const; + virtual bool cull_callback(CullTraverser *trav, const CullTraverserData &data) const; PUBLISHED: - void set_web_view(AwWebView* aw_web_view); - AwWebView* get_web_view() const; - void set_update_active(bool active_flag); - bool get_update_active() const; - void set_flip_texture_active(bool active_flag); - bool get_flip_texture_active() const; + void set_web_view(AwWebView* aw_web_view); + AwWebView* get_web_view() const; + void set_update_active(bool active_flag); + bool get_update_active() const; + void set_flip_texture_active(bool active_flag); + bool get_flip_texture_active() const; //Type handles ---------------- public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - Texture::init_type(); - register_type(_type_handle, "WebBrowserTexture", - Texture::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() {init_type(); return get_class_type();} + static TypeHandle get_class_type() { + return _type_handle; + } + static void init_type() { + Texture::init_type(); + register_type(_type_handle, "WebBrowserTexture", + Texture::get_class_type()); + } + virtual TypeHandle get_type() const { + return get_class_type(); + } + virtual TypeHandle force_init_type() {init_type(); return get_class_type();} private: - static TypeHandle _type_handle; + static TypeHandle _type_handle; }; #endif diff --git a/panda/src/awesomium/awWebCore.h b/panda/src/awesomium/awWebCore.h index 8de1f8e981..354e9823a2 100644 --- a/panda/src/awesomium/awWebCore.h +++ b/panda/src/awesomium/awWebCore.h @@ -32,9 +32,9 @@ PUBLISHED: */ enum LogLevel { - LOG_NONE , // No log is created - LOG_NORMAL , // Logs only errors - LOG_VERBOSE // Logs everything + LOG_NONE , // No log is created + LOG_NORMAL , // Logs only errors + LOG_VERBOSE // Logs everything }; /** @@ -42,8 +42,8 @@ PUBLISHED: */ enum PixelFormat { - PF_BGRA, // BGRA byte ordering [Blue, Green, Red, Alpha] - PF_RGBA // RGBA byte ordering [Red, Green, Blue, Alpha] + PF_BGRA, // BGRA byte ordering [Blue, Green, Red, Alpha] + PF_RGBA // RGBA byte ordering [Red, Green, Blue, Alpha] }; AwWebCore(LogLevel level = LOG_NORMAL, bool enablePlugins = true, PixelFormat pixelFormat = PF_BGRA); diff --git a/panda/src/awesomium/awWebView.h b/panda/src/awesomium/awWebView.h index 1b6d585819..a2b5568c90 100644 --- a/panda/src/awesomium/awWebView.h +++ b/panda/src/awesomium/awWebView.h @@ -34,9 +34,9 @@ PUBLISHED: * and WebView::injectMouseUp */ enum MouseButton { - LEFT_MOUSE_BTN, - MIDDLE_MOUSE_BTN, - RIGHT_MOUSE_BTN + LEFT_MOUSE_BTN, + MIDDLE_MOUSE_BTN, + RIGHT_MOUSE_BTN }; /** diff --git a/panda/src/awesomium/awWebViewListener.cxx b/panda/src/awesomium/awWebViewListener.cxx index 0626faa6e3..42ad5fa969 100644 --- a/panda/src/awesomium/awWebViewListener.cxx +++ b/panda/src/awesomium/awWebViewListener.cxx @@ -29,53 +29,53 @@ void AwWebViewListener::onBeginLoading(const std::string& url, const std::wstrin awesomium_cat.info() << "onBeginLoading" ; } - /** - * This event is fired when all loads have finished for a WebView. - */ + /** + * This event is fired when all loads have finished for a WebView. + */ void AwWebViewListener::onFinishLoading() { } - /** - * This event is fired when a Client callback has been invoked via Javascript from a page. - * - * @param name The name of the client callback that was invoked (specifically, "Client._this_name_here_(...)"). - * - * @param args The arguments passed to the callback. - */ + /** + * This event is fired when a Client callback has been invoked via Javascript from a page. + * + * @param name The name of the client callback that was invoked (specifically, "Client._this_name_here_(...)"). + * + * @param args The arguments passed to the callback. + */ void AwWebViewListener::onCallback(const std::string& name, const Awesomium::JSArguments& args) { } - - /** - * This event is fired when a page title is received. - * - * @param title The page title. - * - * @param frameName The name of the frame that this event originated from. - */ + + /** + * This event is fired when a page title is received. + * + * @param title The page title. + * + * @param frameName The name of the frame that this event originated from. + */ void AwWebViewListener::onReceiveTitle(const std::wstring& title, const std::wstring& frameName) { } - /** - * This event is fired when a tooltip has changed state. - * - * @param tooltip The tooltip text (or, is an empty string when the tooltip should disappear). - */ + /** + * This event is fired when a tooltip has changed state. + * + * @param tooltip The tooltip text (or, is an empty string when the tooltip should disappear). + */ void AwWebViewListener::onChangeTooltip(const std::wstring& tooltip) { } - /** - * This event is fired when keyboard focus has changed. - * - * @param isFocused Whether or not the keyboard is currently focused. - */ + /** + * This event is fired when keyboard focus has changed. + * + * @param isFocused Whether or not the keyboard is currently focused. + */ void AwWebViewListener::onChangeKeyboardFocus(bool isFocused) { } - /** - * This event is fired when the target URL has changed. This is usually the result of - * hovering over a link on the page. - * - * @param url The updated target URL (or empty if the target URL is cleared). - */ + /** + * This event is fired when the target URL has changed. This is usually the result of + * hovering over a link on the page. + * + * @param url The updated target URL (or empty if the target URL is cleared). + */ void AwWebViewListener::onChangeTargetURL(const std::string& url) { } diff --git a/panda/src/awesomium/awWebViewListener.h b/panda/src/awesomium/awWebViewListener.h index d4174a7256..81c137d36f 100644 --- a/panda/src/awesomium/awWebViewListener.h +++ b/panda/src/awesomium/awWebViewListener.h @@ -33,72 +33,72 @@ PUBLISHED: virtual ~AwWebViewListener() {} - /** - * This event is fired when a WebView begins navigating to a new URL. - * - * @param url The URL that is being navigated to. - * - * @param frameName The name of the frame that this event originated from. - */ - void onBeginNavigation(const std::string& url, const std::wstring& frameName) ; + /** + * This event is fired when a WebView begins navigating to a new URL. + * + * @param url The URL that is being navigated to. + * + * @param frameName The name of the frame that this event originated from. + */ + void onBeginNavigation(const std::string& url, const std::wstring& frameName) ; - /** - * This event is fired when a WebView begins to actually receive data from a server. - * - * @param url The URL of the frame that is being loaded. - * - * @param frameName The name of the frame that this event originated from. - * - * @param statusCode The HTTP status code returned by the server. - * - * @param mimeType The mime-type of the content that is being loaded. - */ + /** + * This event is fired when a WebView begins to actually receive data from a server. + * + * @param url The URL of the frame that is being loaded. + * + * @param frameName The name of the frame that this event originated from. + * + * @param statusCode The HTTP status code returned by the server. + * + * @param mimeType The mime-type of the content that is being loaded. + */ void onBeginLoading(const std::string& url, const std::wstring& frameName, int statusCode, const std::wstring& mimeType); - /** - * This event is fired when all loads have finished for a WebView. - */ + /** + * This event is fired when all loads have finished for a WebView. + */ void onFinishLoading(); - /** - * This event is fired when a Client callback has been invoked via Javascript from a page. - * - * @param name The name of the client callback that was invoked (specifically, "Client._this_name_here_(...)"). - * - * @param args The arguments passed to the callback. - */ + /** + * This event is fired when a Client callback has been invoked via Javascript from a page. + * + * @param name The name of the client callback that was invoked (specifically, "Client._this_name_here_(...)"). + * + * @param args The arguments passed to the callback. + */ void onCallback(const std::string& name, const Awesomium::JSArguments& args); - - /** - * This event is fired when a page title is received. - * - * @param title The page title. - * - * @param frameName The name of the frame that this event originated from. - */ + + /** + * This event is fired when a page title is received. + * + * @param title The page title. + * + * @param frameName The name of the frame that this event originated from. + */ void onReceiveTitle(const std::wstring& title, const std::wstring& frameName) ; - /** - * This event is fired when a tooltip has changed state. - * - * @param tooltip The tooltip text (or, is an empty string when the tooltip should disappear). - */ - void onChangeTooltip(const std::wstring& tooltip); + /** + * This event is fired when a tooltip has changed state. + * + * @param tooltip The tooltip text (or, is an empty string when the tooltip should disappear). + */ + void onChangeTooltip(const std::wstring& tooltip); - /** - * This event is fired when keyboard focus has changed. - * - * @param isFocused Whether or not the keyboard is currently focused. - */ - void onChangeKeyboardFocus(bool isFocused) ; + /** + * This event is fired when keyboard focus has changed. + * + * @param isFocused Whether or not the keyboard is currently focused. + */ + void onChangeKeyboardFocus(bool isFocused) ; - /** - * This event is fired when the target URL has changed. This is usually the result of - * hovering over a link on the page. - * - * @param url The updated target URL (or empty if the target URL is cleared). - */ - void onChangeTargetURL(const std::string& url) ; + /** + * This event is fired when the target URL has changed. This is usually the result of + * hovering over a link on the page. + * + * @param url The updated target URL (or empty if the target URL is cleared). + */ + void onChangeTargetURL(const std::string& url) ; public: diff --git a/panda/src/collide/collisionBox.cxx b/panda/src/collide/collisionBox.cxx index 19a1f6ee13..4feb05a3fb 100644 --- a/panda/src/collide/collisionBox.cxx +++ b/panda/src/collide/collisionBox.cxx @@ -35,10 +35,8 @@ #include -PStatCollector CollisionBox::_volume_pcollector( - "Collision Volumes:CollisionBox"); -PStatCollector CollisionBox::_test_pcollector( - "Collision Tests:CollisionBox"); +PStatCollector CollisionBox::_volume_pcollector("Collision Volumes:CollisionBox"); +PStatCollector CollisionBox::_test_pcollector("Collision Tests:CollisionBox"); TypeHandle CollisionBox::_type_handle; const int CollisionBox::plane_def[6][4] = { @@ -113,14 +111,14 @@ setup_points(const LPoint3f *begin, const LPoint3f *end, int plane) { /* // Now make sure the points define a convex polygon. if (is_concave()) { - collide_cat.error() << "Invalid concave CollisionPolygon defined:\n"; - const LPoint3f *pi; - for (pi = begin; pi != end; ++pi) { - collide_cat.error(false) << " " << (*pi) << "\n"; - } - collide_cat.error(false) - << " normal " << normal << " with length " << normal.length() << "\n"; - _points.clear(); + collide_cat.error() << "Invalid concave CollisionPolygon defined:\n"; + const LPoint3f *pi; + for (pi = begin; pi != end; ++pi) { + collide_cat.error(false) << " " << (*pi) << "\n"; + } + collide_cat.error(false) + << " normal " << normal << " with length " << normal.length() << "\n"; + _points.clear(); } */ #endif @@ -147,9 +145,9 @@ void CollisionBox:: xform(const LMatrix4f &mat) { _center = _center * mat; for(int v = 0; v < 8; v++) - _vertex[v] = _vertex[v] * mat; + _vertex[v] = _vertex[v] * mat; for(int p = 0; p < 6 ; p++) - _planes[p] = set_plane(p); + _planes[p] = set_plane(p); _x = _vertex[0].get_x()-_center.get_x(); _y = _vertex[0].get_y()-_center.get_y(); _z = _vertex[0].get_z()-_center.get_z(); @@ -276,7 +274,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { int ip; float max_dist = 0.0; - float dist = 0.0; + float dist = 0.0; bool intersect; Planef plane; LVector3f normal; @@ -287,75 +285,75 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { continue; } if (wrt_prev_space != wrt_space) { - // If we have a delta between the previous position and the - // current position, we use that to determine some more properties - // of the collision. - LPoint3f b = from_center; - LPoint3f a = sphere->get_center() * wrt_prev_space->get_mat(); - LVector3f delta = b - a; + // If we have a delta between the previous position and the + // current position, we use that to determine some more properties + // of the collision. + LPoint3f b = from_center; + LPoint3f a = sphere->get_center() * wrt_prev_space->get_mat(); + LVector3f delta = b - a; - // First, there is no collision if the "from" object is definitely - // moving in the same direction as the plane's normal. - float dot = delta.dot(plane.get_normal()); - if (dot > 0.1f) { - continue; // no intersection - } + // First, there is no collision if the "from" object is definitely + // moving in the same direction as the plane's normal. + float dot = delta.dot(plane.get_normal()); + if (dot > 0.1f) { + continue; // no intersection + } - if (IS_NEARLY_ZERO(dot)) { - // If we're moving parallel to the plane, the sphere is tested - // at its final point. Leave it as it is. + if (IS_NEARLY_ZERO(dot)) { + // If we're moving parallel to the plane, the sphere is tested + // at its final point. Leave it as it is. - } else { - // Otherwise, we're moving into the plane; the sphere is tested - // at the point along its path that is closest to intersecting - // the plane. This may be the actual intersection point, or it - // may be the starting point or the final point. - // dot is equal to the (negative) magnitude of 'delta' along the - // direction of the plane normal - // t = ratio of (distance from start pos to plane) to (distance - // from start pos to end pos), along axis of plane normal - float dist_to_p = plane.dist_to_plane(a); - t = (dist_to_p / -dot); + } else { + // Otherwise, we're moving into the plane; the sphere is tested + // at the point along its path that is closest to intersecting + // the plane. This may be the actual intersection point, or it + // may be the starting point or the final point. + // dot is equal to the (negative) magnitude of 'delta' along the + // direction of the plane normal + // t = ratio of (distance from start pos to plane) to (distance + // from start pos to end pos), along axis of plane normal + float dist_to_p = plane.dist_to_plane(a); + t = (dist_to_p / -dot); - // also compute the actual contact point and time of contact - // for handlers that need it - actual_t = ((dist_to_p - from_radius) / -dot); - actual_t = min(1.0f, max(0.0f, actual_t)); - contact_point = a + (actual_t * delta); + // also compute the actual contact point and time of contact + // for handlers that need it + actual_t = ((dist_to_p - from_radius) / -dot); + actual_t = min(1.0f, max(0.0f, actual_t)); + contact_point = a + (actual_t * delta); - if (t >= 1.0f) { + if (t >= 1.0f) { // Leave it where it is. - } else if (t < 0.0f) { - from_center = a; - moved_from_center = true; - } else { - from_center = a + t * delta; - moved_from_center = true; - } + } else if (t < 0.0f) { + from_center = a; + moved_from_center = true; + } else { + from_center = a + t * delta; + moved_from_center = true; } - } + } + } normal = (has_effective_normal() && sphere->get_respect_effective_normal()) ? get_effective_normal() : plane.get_normal(); - #ifndef NDEBUG +#ifndef NDEBUG /*if (!IS_THRESHOLD_EQUAL(normal.length_squared(), 1.0f, 0.001), NULL) { std::cout << "polygon within " << entry.get_into_node_path() << " has normal " << normal << " of length " << normal.length() << "\n"; normal.normalize(); - }*/ - #endif + }*/ +#endif // The nearest point within the plane to our center is the // intersection of the line (center, center - normal) with the plane. if (!plane.intersects_line(dist, from_center, -(plane.get_normal()))) { - // No intersection with plane? This means the plane's effective - // normal was within the plane itself. A useless polygon. - continue; - } + // No intersection with plane? This means the plane's effective + // normal was within the plane itself. A useless polygon. + continue; + } if (dist > from_radius || dist < -from_radius) { // No intersection with the plane. @@ -394,7 +392,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { } if((edge_dist > 0) && - ((edge_dist * edge_dist + dist * dist) > from_radius_2)) { + ((edge_dist * edge_dist + dist * dist) > from_radius_2)) { // No intersection; the circle is outside the polygon. continue; } @@ -465,7 +463,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { int i, j; float t; - float near_t = 0.0; + float near_t = 0.0; bool intersect; Planef plane; Planef near_plane; @@ -507,8 +505,8 @@ test_intersection_from_ray(const CollisionEntry &entry) const { if(!intersect) { - //No intersection with ANY of the box's planes has been detected - return NULL; + //No intersection with ANY of the box's planes has been detected + return NULL; } if (collide_cat.is_debug()) { @@ -549,7 +547,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const { int i, j; float t; - float near_t = 0.0; + float near_t = 0.0; bool intersect; Planef plane; Planef near_plane; @@ -592,8 +590,8 @@ test_intersection_from_segment(const CollisionEntry &entry) const { if(!intersect) { - //No intersection with ANY of the box's planes has been detected - return NULL; + //No intersection with ANY of the box's planes has been detected + return NULL; } if (collide_cat.is_debug()) { @@ -987,7 +985,7 @@ point_is_inside(const LPoint2f &p, const CollisionBox::Points &points) const { } } if (is_right(p - points[points.size() - 1]._p, - points[0]._p - points[points.size() - 1]._p)) { + points[0]._p - points[points.size() - 1]._p)) { return false; } diff --git a/panda/src/collide/collisionBox.h b/panda/src/collide/collisionBox.h index 3f58a1d10f..6575d6384c 100644 --- a/panda/src/collide/collisionBox.h +++ b/panda/src/collide/collisionBox.h @@ -29,9 +29,9 @@ class EXPCL_PANDA_COLLIDE CollisionBox : public CollisionSolid { PUBLISHED: INLINE CollisionBox(const LPoint3f ¢er, - float x, float y, float z); - INLINE CollisionBox(float cx, float cy, float cz, - float x, float y, float z); + float x, float y, float z); + INLINE CollisionBox(float cx, float cy, float cz, + float x, float y, float z); INLINE CollisionBox(const LPoint3f &min, const LPoint3f &max); virtual LPoint3f get_collision_origin() const; @@ -44,7 +44,7 @@ public: virtual CollisionSolid *make_copy(); virtual PT(CollisionEntry) - test_intersection(const CollisionEntry &entry) const; + test_intersection(const CollisionEntry &entry) const; virtual void xform(const LMatrix4f &mat); virtual PStatCollector &get_volume_pcollector(); @@ -74,13 +74,13 @@ PUBLISHED: protected: virtual PT(BoundingVolume) compute_internal_bounds() const; virtual PT(CollisionEntry) - test_intersection_from_sphere(const CollisionEntry &entry) const; + test_intersection_from_sphere(const CollisionEntry &entry) const; virtual PT(CollisionEntry) - test_intersection_from_ray(const CollisionEntry &entry) const; + test_intersection_from_ray(const CollisionEntry &entry) const; virtual PT(CollisionEntry) - test_intersection_from_segment(const CollisionEntry &entry) const; + test_intersection_from_segment(const CollisionEntry &entry) const; virtual PT(CollisionEntry) - test_intersection_from_box(const CollisionEntry &entry) const; + test_intersection_from_box(const CollisionEntry &entry) const; virtual void fill_viz_geom(); diff --git a/panda/src/display/graphicsOutput.cxx b/panda/src/display/graphicsOutput.cxx index 55a17e1100..36aa69d16f 100644 --- a/panda/src/display/graphicsOutput.cxx +++ b/panda/src/display/graphicsOutput.cxx @@ -348,12 +348,12 @@ add_render_texture(Texture *tex, RenderTextureMode mode, (plane == RTP_aux_float_1)|| (plane == RTP_aux_float_2)|| (plane == RTP_aux_float_3)) { - //defaults to rgba16 unless rgba32 is set. Since many older hardware doesn't - //support 32 or filtering on 32 - tex->set_component_type(Texture::T_float); - if( tex->get_format() != Texture::F_rgba32 ){ - tex->set_format(Texture::F_rgba16); - } + // defaults to rgba16 unless rgba32 is set. Since many older hardware doesn't + // support 32 or filtering on 32 + tex->set_component_type(Texture::T_float); + if( tex->get_format() != Texture::F_rgba32 ){ + tex->set_format(Texture::F_rgba16); + } tex->set_match_framebuffer_format(true); } else { display_cat.error() << diff --git a/panda/src/display/graphicsWindowProc.cxx b/panda/src/display/graphicsWindowProc.cxx index 0c82366640..18593b296d 100644 --- a/panda/src/display/graphicsWindowProc.cxx +++ b/panda/src/display/graphicsWindowProc.cxx @@ -34,7 +34,7 @@ GraphicsWindowProc(){ //////////////////////////////////////////////////////////////////// LONG GraphicsWindowProc:: wnd_proc(GraphicsWindow* graphicsWindow, HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam){ - return 0; + return 0; } #endif diff --git a/panda/src/dxml/tinyxml.h b/panda/src/dxml/tinyxml.h index 01822911c7..d80c5c4e37 100644 --- a/panda/src/dxml/tinyxml.h +++ b/panda/src/dxml/tinyxml.h @@ -44,13 +44,13 @@ distribution. #endif #ifdef TIXML_USE_STL - #include - #include - #include - #define TIXML_STRING std::string + #include + #include + #include + #define TIXML_STRING std::string #else - #include "tinystr.h" - #define TIXML_STRING TiXmlString + #include "tinystr.h" + #define TIXML_STRING TiXmlString #endif // Deprecated library function hell. Compilers want to use the @@ -60,25 +60,25 @@ distribution. #define TIXML_SAFE #ifdef TIXML_SAFE - #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) - // Microsoft visual studio, version 2005 and higher. - #define TIXML_SNPRINTF _snprintf_s - #define TIXML_SSCANF sscanf_s - #elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) - // Microsoft visual studio, version 6 and higher. - //#pragma message( "Using _sn* functions." ) - #define TIXML_SNPRINTF _snprintf - #define TIXML_SSCANF sscanf - #elif defined(__GNUC__) && (__GNUC__ >= 3 ) - // GCC version 3 and higher.s - //#warning( "Using sn* functions." ) - #define TIXML_SNPRINTF snprintf - #define TIXML_SSCANF sscanf - #else - #define TIXML_SNPRINTF snprintf - #define TIXML_SSCANF sscanf - #endif -#endif + #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) + // Microsoft visual studio, version 2005 and higher. + #define TIXML_SNPRINTF _snprintf_s + #define TIXML_SSCANF sscanf_s + #elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) + // Microsoft visual studio, version 6 and higher. + //#pragma message( "Using _sn* functions." ) + #define TIXML_SNPRINTF _snprintf + #define TIXML_SSCANF sscanf + #elif defined(__GNUC__) && (__GNUC__ >= 3 ) + // GCC version 3 and higher.s + //#warning( "Using sn* functions." ) + #define TIXML_SNPRINTF snprintf + #define TIXML_SSCANF sscanf + #else + #define TIXML_SNPRINTF snprintf + #define TIXML_SSCANF sscanf + #endif +#endif class TiXmlDocument; class TiXmlElement; @@ -93,1104 +93,1104 @@ const int TIXML_MAJOR_VERSION = 2; const int TIXML_MINOR_VERSION = 6; const int TIXML_PATCH_VERSION = 1; -/* Internal structure for tracking location of items - in the XML file. +/* Internal structure for tracking location of items + in the XML file. */ struct TiXmlCursor { - TiXmlCursor() { Clear(); } - void Clear() { row = col = -1; } + TiXmlCursor() { Clear(); } + void Clear() { row = col = -1; } - int row; // 0 based. - int col; // 0 based. + int row; // 0 based. + int col; // 0 based. }; /** - Implements the interface to the "Visitor pattern" (see the Accept() method.) - If you call the Accept() method, it requires being passed a TiXmlVisitor - class to handle callbacks. For nodes that contain other nodes (Document, Element) - you will get called with a VisitEnter/VisitExit pair. Nodes that are always leaves - are simply called with Visit(). + Implements the interface to the "Visitor pattern" (see the Accept() method.) + If you call the Accept() method, it requires being passed a TiXmlVisitor + class to handle callbacks. For nodes that contain other nodes (Document, Element) + you will get called with a VisitEnter/VisitExit pair. Nodes that are always leaves + are simply called with Visit(). - If you return 'true' from a Visit method, recursive parsing will continue. If you return - false, no children of this node or its sibilings will be Visited. + If you return 'true' from a Visit method, recursive parsing will continue. If you return + false, no children of this node or its sibilings will be Visited. - All flavors of Visit methods have a default implementation that returns 'true' (continue - visiting). You need to only override methods that are interesting to you. + All flavors of Visit methods have a default implementation that returns 'true' (continue + visiting). You need to only override methods that are interesting to you. - Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting. + Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting. - You should never change the document from a callback. + You should never change the document from a callback. - @sa TiXmlNode::Accept() + @sa TiXmlNode::Accept() */ class TiXmlVisitor { public: - virtual ~TiXmlVisitor() {} + virtual ~TiXmlVisitor() {} - /// Visit a document. - virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) { return true; } - /// Visit a document. - virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) { return true; } + /// Visit a document. + virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) { return true; } + /// Visit a document. + virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) { return true; } - /// Visit an element. - virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) { return true; } - /// Visit an element. - virtual bool VisitExit( const TiXmlElement& /*element*/ ) { return true; } + /// Visit an element. + virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) { return true; } + /// Visit an element. + virtual bool VisitExit( const TiXmlElement& /*element*/ ) { return true; } - /// Visit a declaration - virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) { return true; } - /// Visit a text node - virtual bool Visit( const TiXmlText& /*text*/ ) { return true; } - /// Visit a comment node - virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; } - /// Visit an unknow node - virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; } + /// Visit a declaration + virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) { return true; } + /// Visit a text node + virtual bool Visit( const TiXmlText& /*text*/ ) { return true; } + /// Visit a comment node + virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; } + /// Visit an unknow node + virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; } }; // Only used by Attribute::Query functions enum { - TIXML_SUCCESS, - TIXML_NO_ATTRIBUTE, - TIXML_WRONG_TYPE + TIXML_SUCCESS, + TIXML_NO_ATTRIBUTE, + TIXML_WRONG_TYPE }; // Used by the parsing routines. enum TiXmlEncoding { - TIXML_ENCODING_UNKNOWN, - TIXML_ENCODING_UTF8, - TIXML_ENCODING_LEGACY + TIXML_ENCODING_UNKNOWN, + TIXML_ENCODING_UTF8, + TIXML_ENCODING_LEGACY }; const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN; /** TiXmlBase is a base class for every class in TinyXml. - It does little except to establish that TinyXml classes - can be printed and provide some utility functions. + It does little except to establish that TinyXml classes + can be printed and provide some utility functions. - In XML, the document and elements can contain - other elements and other types of nodes. + In XML, the document and elements can contain + other elements and other types of nodes. - @verbatim - A Document can contain: Element (container or leaf) - Comment (leaf) - Unknown (leaf) - Declaration( leaf ) + @verbatim + A Document can contain: Element (container or leaf) + Comment (leaf) + Unknown (leaf) + Declaration( leaf ) - An Element can contain: Element (container or leaf) - Text (leaf) - Attributes (not on tree) - Comment (leaf) - Unknown (leaf) + An Element can contain: Element (container or leaf) + Text (leaf) + Attributes (not on tree) + Comment (leaf) + Unknown (leaf) - A Decleration contains: Attributes (not on tree) - @endverbatim + A Decleration contains: Attributes (not on tree) + @endverbatim */ class TiXmlBase { - friend class TiXmlNode; - friend class TiXmlElement; - friend class TiXmlDocument; + friend class TiXmlNode; + friend class TiXmlElement; + friend class TiXmlDocument; public: - TiXmlBase() : userData(0) {} - virtual ~TiXmlBase() {} + TiXmlBase() : userData(0) {} + virtual ~TiXmlBase() {} - /** All TinyXml classes can print themselves to a filestream - or the string class (TiXmlString in non-STL mode, std::string - in STL mode.) Either or both cfile and str can be null. - - This is a formatted print, and will insert - tabs and newlines. - - (For an unformatted stream, use the << operator.) - */ - virtual void Print( FILE* cfile, int depth ) const = 0; + /** All TinyXml classes can print themselves to a filestream + or the string class (TiXmlString in non-STL mode, std::string + in STL mode.) Either or both cfile and str can be null. + + This is a formatted print, and will insert + tabs and newlines. + + (For an unformatted stream, use the << operator.) + */ + virtual void Print( FILE* cfile, int depth ) const = 0; - /** The world does not agree on whether white space should be kept or - not. In order to make everyone happy, these global, static functions - are provided to set whether or not TinyXml will condense all white space - into a single space or not. The default is to condense. Note changing this - value is not thread safe. - */ - static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; } + /** The world does not agree on whether white space should be kept or + not. In order to make everyone happy, these global, static functions + are provided to set whether or not TinyXml will condense all white space + into a single space or not. The default is to condense. Note changing this + value is not thread safe. + */ + static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; } - /// Return the current white space setting. - static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; } + /// Return the current white space setting. + static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; } - /** Return the position, in the original source file, of this node or attribute. - The row and column are 1-based. (That is the first row and first column is - 1,1). If the returns values are 0 or less, then the parser does not have - a row and column value. + /** Return the position, in the original source file, of this node or attribute. + The row and column are 1-based. (That is the first row and first column is + 1,1). If the returns values are 0 or less, then the parser does not have + a row and column value. - Generally, the row and column value will be set when the TiXmlDocument::Load(), - TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set - when the DOM was created from operator>>. + Generally, the row and column value will be set when the TiXmlDocument::Load(), + TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set + when the DOM was created from operator>>. - The values reflect the initial load. Once the DOM is modified programmatically - (by adding or changing nodes and attributes) the new values will NOT update to - reflect changes in the document. + The values reflect the initial load. Once the DOM is modified programmatically + (by adding or changing nodes and attributes) the new values will NOT update to + reflect changes in the document. - There is a minor performance cost to computing the row and column. Computation - can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value. + There is a minor performance cost to computing the row and column. Computation + can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value. - @sa TiXmlDocument::SetTabSize() - */ - int Row() const { return location.row + 1; } - int Column() const { return location.col + 1; } ///< See Row() + @sa TiXmlDocument::SetTabSize() + */ + int Row() const { return location.row + 1; } + int Column() const { return location.col + 1; } ///< See Row() - void SetUserData( void* user ) { userData = user; } ///< Set a pointer to arbitrary user data. - void* GetUserData() { return userData; } ///< Get a pointer to arbitrary user data. - const void* GetUserData() const { return userData; } ///< Get a pointer to arbitrary user data. + void SetUserData( void* user ) { userData = user; } ///< Set a pointer to arbitrary user data. + void* GetUserData() { return userData; } ///< Get a pointer to arbitrary user data. + const void* GetUserData() const { return userData; } ///< Get a pointer to arbitrary user data. - // Table that returs, for a given lead byte, the total number of bytes - // in the UTF-8 sequence. - static const int utf8ByteTable[256]; + // Table that returs, for a given lead byte, the total number of bytes + // in the UTF-8 sequence. + static const int utf8ByteTable[256]; - virtual const char* Parse( const char* p, - TiXmlParsingData* data, - TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; + virtual const char* Parse( const char* p, + TiXmlParsingData* data, + TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; - /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc, - or they will be transformed into entities! - */ - static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out ); + /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc, + or they will be transformed into entities! + */ + static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out ); - enum - { - TIXML_NO_ERROR = 0, - TIXML_ERROR, - TIXML_ERROR_OPENING_FILE, - TIXML_ERROR_PARSING_ELEMENT, - TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, - TIXML_ERROR_READING_ELEMENT_VALUE, - TIXML_ERROR_READING_ATTRIBUTES, - TIXML_ERROR_PARSING_EMPTY, - TIXML_ERROR_READING_END_TAG, - TIXML_ERROR_PARSING_UNKNOWN, - TIXML_ERROR_PARSING_COMMENT, - TIXML_ERROR_PARSING_DECLARATION, - TIXML_ERROR_DOCUMENT_EMPTY, - TIXML_ERROR_EMBEDDED_NULL, - TIXML_ERROR_PARSING_CDATA, - TIXML_ERROR_DOCUMENT_TOP_ONLY, + enum + { + TIXML_NO_ERROR = 0, + TIXML_ERROR, + TIXML_ERROR_OPENING_FILE, + TIXML_ERROR_PARSING_ELEMENT, + TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, + TIXML_ERROR_READING_ELEMENT_VALUE, + TIXML_ERROR_READING_ATTRIBUTES, + TIXML_ERROR_PARSING_EMPTY, + TIXML_ERROR_READING_END_TAG, + TIXML_ERROR_PARSING_UNKNOWN, + TIXML_ERROR_PARSING_COMMENT, + TIXML_ERROR_PARSING_DECLARATION, + TIXML_ERROR_DOCUMENT_EMPTY, + TIXML_ERROR_EMBEDDED_NULL, + TIXML_ERROR_PARSING_CDATA, + TIXML_ERROR_DOCUMENT_TOP_ONLY, - TIXML_ERROR_STRING_COUNT - }; + TIXML_ERROR_STRING_COUNT + }; protected: - static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); + static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); - inline static bool IsWhiteSpace( char c ) - { - return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); - } - inline static bool IsWhiteSpace( int c ) - { - if ( c < 256 ) - return IsWhiteSpace( (char) c ); - return false; // Again, only truly correct for English/Latin...but usually works. - } + inline static bool IsWhiteSpace( char c ) + { + return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); + } + inline static bool IsWhiteSpace( int c ) + { + if ( c < 256 ) + return IsWhiteSpace( (char) c ); + return false; // Again, only truly correct for English/Latin...but usually works. + } - #ifdef TIXML_USE_STL - static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ); - static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag ); - #endif + #ifdef TIXML_USE_STL + static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ); + static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag ); + #endif - /* Reads an XML name into the string provided. Returns - a pointer just past the last character of the name, - or 0 if the function has an error. - */ - static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ); + /* Reads an XML name into the string provided. Returns + a pointer just past the last character of the name, + or 0 if the function has an error. + */ + static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ); - /* Reads text. Returns a pointer past the given end tag. - Wickedly complex options, but it keeps the (sensitive) code in one place. - */ - static const char* ReadText( const char* in, // where to start - TIXML_STRING* text, // the string read - bool ignoreWhiteSpace, // whether to keep the white space - const char* endTag, // what ends this text - bool ignoreCase, // whether to ignore case in the end tag - TiXmlEncoding encoding ); // the current encoding + /* Reads text. Returns a pointer past the given end tag. + Wickedly complex options, but it keeps the (sensitive) code in one place. + */ + static const char* ReadText( const char* in, // where to start + TIXML_STRING* text, // the string read + bool ignoreWhiteSpace, // whether to keep the white space + const char* endTag, // what ends this text + bool ignoreCase, // whether to ignore case in the end tag + TiXmlEncoding encoding ); // the current encoding - // If an entity has been found, transform it into a character. - static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding ); + // If an entity has been found, transform it into a character. + static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding ); - // Get a character, while interpreting entities. - // The length can be from 0 to 4 bytes. - inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding ) - { - assert( p ); - if ( encoding == TIXML_ENCODING_UTF8 ) - { - *length = utf8ByteTable[ *((const unsigned char*)p) ]; - assert( *length >= 0 && *length < 5 ); - } - else - { - *length = 1; - } + // Get a character, while interpreting entities. + // The length can be from 0 to 4 bytes. + inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding ) + { + assert( p ); + if ( encoding == TIXML_ENCODING_UTF8 ) + { + *length = utf8ByteTable[ *((const unsigned char*)p) ]; + assert( *length >= 0 && *length < 5 ); + } + else + { + *length = 1; + } - if ( *length == 1 ) - { - if ( *p == '&' ) - return GetEntity( p, _value, length, encoding ); - *_value = *p; - return p+1; - } - else if ( *length ) - { - //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe), - // and the null terminator isn't needed - for( int i=0; p[i] && i<*length; ++i ) { - _value[i] = p[i]; - } - return p + (*length); - } - else - { - // Not valid text. - return 0; - } - } + if ( *length == 1 ) + { + if ( *p == '&' ) + return GetEntity( p, _value, length, encoding ); + *_value = *p; + return p+1; + } + else if ( *length ) + { + //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe), + // and the null terminator isn't needed + for( int i=0; p[i] && i<*length; ++i ) { + _value[i] = p[i]; + } + return p + (*length); + } + else + { + // Not valid text. + return 0; + } + } - // Return true if the next characters in the stream are any of the endTag sequences. - // Ignore case only works for english, and should only be relied on when comparing - // to English words: StringEqual( p, "version", true ) is fine. - static bool StringEqual( const char* p, - const char* endTag, - bool ignoreCase, - TiXmlEncoding encoding ); + // Return true if the next characters in the stream are any of the endTag sequences. + // Ignore case only works for english, and should only be relied on when comparing + // to English words: StringEqual( p, "version", true ) is fine. + static bool StringEqual( const char* p, + const char* endTag, + bool ignoreCase, + TiXmlEncoding encoding ); - static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; + static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; - TiXmlCursor location; + TiXmlCursor location; /// Field containing a generic user pointer - void* userData; - - // None of these methods are reliable for any language except English. - // Good for approximation, not great for accuracy. - static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); - static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding ); - inline static int ToLower( int v, TiXmlEncoding encoding ) - { - if ( encoding == TIXML_ENCODING_UTF8 ) - { - if ( v < 128 ) return tolower( v ); - return v; - } - else - { - return tolower( v ); - } - } - static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); + void* userData; + + // None of these methods are reliable for any language except English. + // Good for approximation, not great for accuracy. + static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); + static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding ); + inline static int ToLower( int v, TiXmlEncoding encoding ) + { + if ( encoding == TIXML_ENCODING_UTF8 ) + { + if ( v < 128 ) return tolower( v ); + return v; + } + else + { + return tolower( v ); + } + } + static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); private: - TiXmlBase( const TiXmlBase& ); // not implemented. - void operator=( const TiXmlBase& base ); // not allowed. + TiXmlBase( const TiXmlBase& ); // not implemented. + void operator=( const TiXmlBase& base ); // not allowed. - struct Entity - { - const char* str; - unsigned int strLength; - char chr; - }; - enum - { - NUM_ENTITY = 5, - MAX_ENTITY_LENGTH = 6 + struct Entity + { + const char* str; + unsigned int strLength; + char chr; + }; + enum + { + NUM_ENTITY = 5, + MAX_ENTITY_LENGTH = 6 - }; - static Entity entity[ NUM_ENTITY ]; - static bool condenseWhiteSpace; + }; + static Entity entity[ NUM_ENTITY ]; + static bool condenseWhiteSpace; }; /** The parent class for everything in the Document Object Model. - (Except for attributes). - Nodes have siblings, a parent, and children. A node can be - in a document, or stand on its own. The type of a TiXmlNode - can be queried, and it can be cast to its more defined type. + (Except for attributes). + Nodes have siblings, a parent, and children. A node can be + in a document, or stand on its own. The type of a TiXmlNode + can be queried, and it can be cast to its more defined type. */ class TiXmlNode : public TiXmlBase { - friend class TiXmlDocument; - friend class TiXmlElement; + friend class TiXmlDocument; + friend class TiXmlElement; public: - #ifdef TIXML_USE_STL + #ifdef TIXML_USE_STL - /** An input stream operator, for every class. Tolerant of newlines and - formatting, but doesn't expect them. - */ - friend std::istream& operator >> (std::istream& in, TiXmlNode& base); + /** An input stream operator, for every class. Tolerant of newlines and + formatting, but doesn't expect them. + */ + friend std::istream& operator >> (std::istream& in, TiXmlNode& base); - /** An output stream operator, for every class. Note that this outputs - without any newlines or formatting, as opposed to Print(), which - includes tabs and new lines. + /** An output stream operator, for every class. Note that this outputs + without any newlines or formatting, as opposed to Print(), which + includes tabs and new lines. - The operator<< and operator>> are not completely symmetric. Writing - a node to a stream is very well defined. You'll get a nice stream - of output, without any extra whitespace or newlines. - - But reading is not as well defined. (As it always is.) If you create - a TiXmlElement (for example) and read that from an input stream, - the text needs to define an element or junk will result. This is - true of all input streams, but it's worth keeping in mind. + The operator<< and operator>> are not completely symmetric. Writing + a node to a stream is very well defined. You'll get a nice stream + of output, without any extra whitespace or newlines. + + But reading is not as well defined. (As it always is.) If you create + a TiXmlElement (for example) and read that from an input stream, + the text needs to define an element or junk will result. This is + true of all input streams, but it's worth keeping in mind. - A TiXmlDocument will read nodes until it reads a root element, and - all the children of that root element. - */ - friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base); + A TiXmlDocument will read nodes until it reads a root element, and + all the children of that root element. + */ + friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base); - /// Appends the XML node or attribute to a std::string. - friend std::string& operator<< (std::string& out, const TiXmlNode& base ); + /// Appends the XML node or attribute to a std::string. + friend std::string& operator<< (std::string& out, const TiXmlNode& base ); - #endif + #endif - /** The types of XML nodes supported by TinyXml. (All the - unsupported types are picked up by UNKNOWN.) - */ - enum NodeType - { - TINYXML_DOCUMENT, - TINYXML_ELEMENT, - TINYXML_COMMENT, - TINYXML_UNKNOWN, - TINYXML_TEXT, - TINYXML_DECLARATION, - TINYXML_TYPECOUNT - }; + /** The types of XML nodes supported by TinyXml. (All the + unsupported types are picked up by UNKNOWN.) + */ + enum NodeType + { + TINYXML_DOCUMENT, + TINYXML_ELEMENT, + TINYXML_COMMENT, + TINYXML_UNKNOWN, + TINYXML_TEXT, + TINYXML_DECLARATION, + TINYXML_TYPECOUNT + }; - virtual ~TiXmlNode(); + virtual ~TiXmlNode(); - /** The meaning of 'value' changes for the specific type of - TiXmlNode. - @verbatim - Document: filename of the xml file - Element: name of the element - Comment: the comment text - Unknown: the tag contents - Text: the text string - @endverbatim + /** The meaning of 'value' changes for the specific type of + TiXmlNode. + @verbatim + Document: filename of the xml file + Element: name of the element + Comment: the comment text + Unknown: the tag contents + Text: the text string + @endverbatim - The subclasses will wrap this function. - */ - const char *Value() const { return value.c_str (); } + The subclasses will wrap this function. + */ + const char *Value() const { return value.c_str (); } #ifdef TIXML_USE_STL - /** Return Value() as a std::string. If you only use STL, - this is more efficient than calling Value(). - Only available in STL mode. - */ - const std::string& ValueStr() const { return value; } - #endif + /** Return Value() as a std::string. If you only use STL, + this is more efficient than calling Value(). + Only available in STL mode. + */ + const std::string& ValueStr() const { return value; } + #endif - const TIXML_STRING& ValueTStr() const { return value; } + const TIXML_STRING& ValueTStr() const { return value; } - /** Changes the value of the node. Defined as: - @verbatim - Document: filename of the xml file - Element: name of the element - Comment: the comment text - Unknown: the tag contents - Text: the text string - @endverbatim - */ - void SetValue(const char * _value) { value = _value;} + /** Changes the value of the node. Defined as: + @verbatim + Document: filename of the xml file + Element: name of the element + Comment: the comment text + Unknown: the tag contents + Text: the text string + @endverbatim + */ + void SetValue(const char * _value) { value = _value;} #ifdef TIXML_USE_STL - /// STL std::string form. - void SetValue( const std::string& _value ) { value = _value; } - #endif + /// STL std::string form. + void SetValue( const std::string& _value ) { value = _value; } + #endif - /// Delete all the children of this node. Does not affect 'this'. - void Clear(); + /// Delete all the children of this node. Does not affect 'this'. + void Clear(); - /// One step up the DOM. - TiXmlNode* Parent() { return parent; } - const TiXmlNode* Parent() const { return parent; } + /// One step up the DOM. + TiXmlNode* Parent() { return parent; } + const TiXmlNode* Parent() const { return parent; } - const TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children. - TiXmlNode* FirstChild() { return firstChild; } - const TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found. - /// The first child of this node with the matching 'value'. Will be null if none found. - TiXmlNode* FirstChild( const char * _value ) { - // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) - // call the method, cast the return back to non-const. - return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); - } - const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. - TiXmlNode* LastChild() { return lastChild; } - - const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. - TiXmlNode* LastChild( const char * _value ) { - return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); - } + const TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children. + TiXmlNode* FirstChild() { return firstChild; } + const TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found. + /// The first child of this node with the matching 'value'. Will be null if none found. + TiXmlNode* FirstChild( const char * _value ) { + // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) + // call the method, cast the return back to non-const. + return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); + } + const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. + TiXmlNode* LastChild() { return lastChild; } + + const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. + TiXmlNode* LastChild( const char * _value ) { + return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); + } #ifdef TIXML_USE_STL - const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< STL std::string form. - const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< STL std::string form. - #endif + const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< STL std::string form. + const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< STL std::string form. + #endif - /** An alternate way to walk the children of a node. - One way to iterate over nodes is: - @verbatim - for( child = parent->FirstChild(); child; child = child->NextSibling() ) - @endverbatim + /** An alternate way to walk the children of a node. + One way to iterate over nodes is: + @verbatim + for( child = parent->FirstChild(); child; child = child->NextSibling() ) + @endverbatim - IterateChildren does the same thing with the syntax: - @verbatim - child = 0; - while( child = parent->IterateChildren( child ) ) - @endverbatim + IterateChildren does the same thing with the syntax: + @verbatim + child = 0; + while( child = parent->IterateChildren( child ) ) + @endverbatim - IterateChildren takes the previous child as input and finds - the next one. If the previous child is null, it returns the - first. IterateChildren will return null when done. - */ - const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; - TiXmlNode* IterateChildren( const TiXmlNode* previous ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); - } + IterateChildren takes the previous child as input and finds + the next one. If the previous child is null, it returns the + first. IterateChildren will return null when done. + */ + const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; + TiXmlNode* IterateChildren( const TiXmlNode* previous ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); + } - /// This flavor of IterateChildren searches for children with a particular 'value' - const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const; - TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); - } + /// This flavor of IterateChildren searches for children with a particular 'value' + const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const; + TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); + } #ifdef TIXML_USE_STL - const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. - TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. - #endif + const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. + TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. + #endif - /** Add a new node related to this. Adds a child past the LastChild. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); + /** Add a new node related to this. Adds a child past the LastChild. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); - /** Add a new node related to this. Adds a child past the LastChild. + /** Add a new node related to this. Adds a child past the LastChild. - NOTE: the node to be added is passed by pointer, and will be - henceforth owned (and deleted) by tinyXml. This method is efficient - and avoids an extra copy, but should be used with care as it - uses a different memory model than the other insert functions. + NOTE: the node to be added is passed by pointer, and will be + henceforth owned (and deleted) by tinyXml. This method is efficient + and avoids an extra copy, but should be used with care as it + uses a different memory model than the other insert functions. - @sa InsertEndChild - */ - TiXmlNode* LinkEndChild( TiXmlNode* addThis ); + @sa InsertEndChild + */ + TiXmlNode* LinkEndChild( TiXmlNode* addThis ); - /** Add a new node related to this. Adds a child before the specified child. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ); + /** Add a new node related to this. Adds a child before the specified child. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ); - /** Add a new node related to this. Adds a child after the specified child. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ); + /** Add a new node related to this. Adds a child after the specified child. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ); - /** Replace a child of this node. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ); + /** Replace a child of this node. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ); - /// Delete a child of this node. - bool RemoveChild( TiXmlNode* removeThis ); + /// Delete a child of this node. + bool RemoveChild( TiXmlNode* removeThis ); - /// Navigate to a sibling node. - const TiXmlNode* PreviousSibling() const { return prev; } - TiXmlNode* PreviousSibling() { return prev; } + /// Navigate to a sibling node. + const TiXmlNode* PreviousSibling() const { return prev; } + TiXmlNode* PreviousSibling() { return prev; } - /// Navigate to a sibling node. - const TiXmlNode* PreviousSibling( const char * ) const; - TiXmlNode* PreviousSibling( const char *_prev ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); - } + /// Navigate to a sibling node. + const TiXmlNode* PreviousSibling( const char * ) const; + TiXmlNode* PreviousSibling( const char *_prev ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); + } #ifdef TIXML_USE_STL - const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. - const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form. - #endif + const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. + const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form. + #endif - /// Navigate to a sibling node. - const TiXmlNode* NextSibling() const { return next; } - TiXmlNode* NextSibling() { return next; } + /// Navigate to a sibling node. + const TiXmlNode* NextSibling() const { return next; } + TiXmlNode* NextSibling() { return next; } - /// Navigate to a sibling node with the given 'value'. - const TiXmlNode* NextSibling( const char * ) const; - TiXmlNode* NextSibling( const char* _next ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); - } + /// Navigate to a sibling node with the given 'value'. + const TiXmlNode* NextSibling( const char * ) const; + TiXmlNode* NextSibling( const char* _next ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); + } - /** Convenience function to get through elements. - Calls NextSibling and ToElement. Will skip all non-Element - nodes. Returns 0 if there is not another element. - */ - const TiXmlElement* NextSiblingElement() const; - TiXmlElement* NextSiblingElement() { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); - } + /** Convenience function to get through elements. + Calls NextSibling and ToElement. Will skip all non-Element + nodes. Returns 0 if there is not another element. + */ + const TiXmlElement* NextSiblingElement() const; + TiXmlElement* NextSiblingElement() { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); + } - /** Convenience function to get through elements. - Calls NextSibling and ToElement. Will skip all non-Element - nodes. Returns 0 if there is not another element. - */ - const TiXmlElement* NextSiblingElement( const char * ) const; - TiXmlElement* NextSiblingElement( const char *_next ) { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); - } + /** Convenience function to get through elements. + Calls NextSibling and ToElement. Will skip all non-Element + nodes. Returns 0 if there is not another element. + */ + const TiXmlElement* NextSiblingElement( const char * ) const; + TiXmlElement* NextSiblingElement( const char *_next ) { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); + } #ifdef TIXML_USE_STL - const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. - TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. - #endif + const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. + TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. + #endif - /// Convenience function to get through elements. - const TiXmlElement* FirstChildElement() const; - TiXmlElement* FirstChildElement() { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); - } + /// Convenience function to get through elements. + const TiXmlElement* FirstChildElement() const; + TiXmlElement* FirstChildElement() { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); + } - /// Convenience function to get through elements. - const TiXmlElement* FirstChildElement( const char * _value ) const; - TiXmlElement* FirstChildElement( const char * _value ) { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); - } + /// Convenience function to get through elements. + const TiXmlElement* FirstChildElement( const char * _value ) const; + TiXmlElement* FirstChildElement( const char * _value ) { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); + } #ifdef TIXML_USE_STL - const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. - TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. - #endif + const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. + TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. + #endif - /** Query the type (as an enumerated value, above) of this node. - The possible types are: DOCUMENT, ELEMENT, COMMENT, - UNKNOWN, TEXT, and DECLARATION. - */ - int Type() const { return type; } + /** Query the type (as an enumerated value, above) of this node. + The possible types are: DOCUMENT, ELEMENT, COMMENT, + UNKNOWN, TEXT, and DECLARATION. + */ + int Type() const { return type; } - /** Return a pointer to the Document this node lives in. - Returns null if not in a document. - */ - const TiXmlDocument* GetDocument() const; - TiXmlDocument* GetDocument() { - return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); - } + /** Return a pointer to the Document this node lives in. + Returns null if not in a document. + */ + const TiXmlDocument* GetDocument() const; + TiXmlDocument* GetDocument() { + return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); + } - /// Returns true if this node has no children. - bool NoChildren() const { return !firstChild; } + /// Returns true if this node has no children. + bool NoChildren() const { return !firstChild; } - virtual const TiXmlDocument* ToDocument() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlElement* ToElement() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlComment* ToComment() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlUnknown* ToUnknown() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlText* ToText() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlDocument* ToDocument() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlElement* ToElement() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlComment* ToComment() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlUnknown* ToUnknown() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlText* ToText() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlDocument* ToDocument() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlElement* ToElement() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlComment* ToComment() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlUnknown* ToUnknown() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlText* ToText() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlDocument* ToDocument() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlElement* ToElement() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlComment* ToComment() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlUnknown* ToUnknown() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlText* ToText() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - /** Create an exact duplicate of this node and return it. The memory must be deleted - by the caller. - */ - virtual TiXmlNode* Clone() const = 0; + /** Create an exact duplicate of this node and return it. The memory must be deleted + by the caller. + */ + virtual TiXmlNode* Clone() const = 0; - /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the - XML tree will be conditionally visited and the host will be called back - via the TiXmlVisitor interface. + /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the + XML tree will be conditionally visited and the host will be called back + via the TiXmlVisitor interface. - This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse - the XML for the callbacks, so the performance of TinyXML is unchanged by using this - interface versus any other.) + This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse + the XML for the callbacks, so the performance of TinyXML is unchanged by using this + interface versus any other.) - The interface has been based on ideas from: + The interface has been based on ideas from: - - http://www.saxproject.org/ - - http://c2.com/cgi/wiki?HierarchicalVisitorPattern + - http://www.saxproject.org/ + - http://c2.com/cgi/wiki?HierarchicalVisitorPattern - Which are both good references for "visiting". + Which are both good references for "visiting". - An example of using Accept(): - @verbatim - TiXmlPrinter printer; - tinyxmlDoc.Accept( &printer ); - const char* xmlcstr = printer.CStr(); - @endverbatim - */ - virtual bool Accept( TiXmlVisitor* visitor ) const = 0; + An example of using Accept(): + @verbatim + TiXmlPrinter printer; + tinyxmlDoc.Accept( &printer ); + const char* xmlcstr = printer.CStr(); + @endverbatim + */ + virtual bool Accept( TiXmlVisitor* visitor ) const = 0; protected: - TiXmlNode( NodeType _type ); + TiXmlNode( NodeType _type ); - // Copy to the allocated object. Shared functionality between Clone, Copy constructor, - // and the assignment operator. - void CopyTo( TiXmlNode* target ) const; + // Copy to the allocated object. Shared functionality between Clone, Copy constructor, + // and the assignment operator. + void CopyTo( TiXmlNode* target ) const; - #ifdef TIXML_USE_STL - // The real work of the input operator. - virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0; - #endif + #ifdef TIXML_USE_STL + // The real work of the input operator. + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0; + #endif - // Figure out what is at *p, and parse it. Returns null if it is not an xml node. - TiXmlNode* Identify( const char* start, TiXmlEncoding encoding ); + // Figure out what is at *p, and parse it. Returns null if it is not an xml node. + TiXmlNode* Identify( const char* start, TiXmlEncoding encoding ); - TiXmlNode* parent; - NodeType type; + TiXmlNode* parent; + NodeType type; - TiXmlNode* firstChild; - TiXmlNode* lastChild; + TiXmlNode* firstChild; + TiXmlNode* lastChild; - TIXML_STRING value; + TIXML_STRING value; - TiXmlNode* prev; - TiXmlNode* next; + TiXmlNode* prev; + TiXmlNode* next; private: - TiXmlNode( const TiXmlNode& ); // not implemented. - void operator=( const TiXmlNode& base ); // not allowed. + TiXmlNode( const TiXmlNode& ); // not implemented. + void operator=( const TiXmlNode& base ); // not allowed. }; /** An attribute is a name-value pair. Elements have an arbitrary - number of attributes, each with a unique name. + number of attributes, each with a unique name. - @note The attributes are not TiXmlNodes, since they are not - part of the tinyXML document object model. There are other - suggested ways to look at this problem. + @note The attributes are not TiXmlNodes, since they are not + part of the tinyXML document object model. There are other + suggested ways to look at this problem. */ class TiXmlAttribute : public TiXmlBase { - friend class TiXmlAttributeSet; + friend class TiXmlAttributeSet; public: - /// Construct an empty attribute. - TiXmlAttribute() : TiXmlBase() - { - document = 0; - prev = next = 0; - } - - #ifdef TIXML_USE_STL - /// std::string constructor. - TiXmlAttribute( const std::string& _name, const std::string& _value ) - { - name = _name; - value = _value; - document = 0; - prev = next = 0; - } - #endif - - /// Construct an attribute with a name and value. - TiXmlAttribute( const char * _name, const char * _value ) - { - name = _name; - value = _value; - document = 0; - prev = next = 0; - } - - const char* Name() const { return name.c_str(); } ///< Return the name of this attribute. - const char* Value() const { return value.c_str(); } ///< Return the value of this attribute. - #ifdef TIXML_USE_STL - const std::string& ValueStr() const { return value; } ///< Return the value of this attribute. - #endif - int IntValue() const; ///< Return the value of this attribute, converted to an integer. - double DoubleValue() const; ///< Return the value of this attribute, converted to a double. - - // Get the tinyxml string representation - const TIXML_STRING& NameTStr() const { return name; } - - /** QueryIntValue examines the value string. It is an alternative to the - IntValue() method with richer error checking. - If the value is an integer, it is stored in 'value' and - the call returns TIXML_SUCCESS. If it is not - an integer, it returns TIXML_WRONG_TYPE. - - A specialized but useful call. Note that for success it returns 0, - which is the opposite of almost all other TinyXml calls. - */ - int QueryIntValue( int* _value ) const; - /// QueryDoubleValue examines the value string. See QueryIntValue(). - int QueryDoubleValue( double* _value ) const; - - void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute. - void SetValue( const char* _value ) { value = _value; } ///< Set the value. - - void SetIntValue( int _value ); ///< Set the value from an integer. - void SetDoubleValue( double _value ); ///< Set the value from a double. + /// Construct an empty attribute. + TiXmlAttribute() : TiXmlBase() + { + document = 0; + prev = next = 0; + } #ifdef TIXML_USE_STL - /// STL std::string form. - void SetName( const std::string& _name ) { name = _name; } - /// STL std::string form. - void SetValue( const std::string& _value ) { value = _value; } - #endif + /// std::string constructor. + TiXmlAttribute( const std::string& _name, const std::string& _value ) + { + name = _name; + value = _value; + document = 0; + prev = next = 0; + } + #endif - /// Get the next sibling attribute in the DOM. Returns null at end. - const TiXmlAttribute* Next() const; - TiXmlAttribute* Next() { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); - } + /// Construct an attribute with a name and value. + TiXmlAttribute( const char * _name, const char * _value ) + { + name = _name; + value = _value; + document = 0; + prev = next = 0; + } - /// Get the previous sibling attribute in the DOM. Returns null at beginning. - const TiXmlAttribute* Previous() const; - TiXmlAttribute* Previous() { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); - } + const char* Name() const { return name.c_str(); } ///< Return the name of this attribute. + const char* Value() const { return value.c_str(); } ///< Return the value of this attribute. + #ifdef TIXML_USE_STL + const std::string& ValueStr() const { return value; } ///< Return the value of this attribute. + #endif + int IntValue() const; ///< Return the value of this attribute, converted to an integer. + double DoubleValue() const; ///< Return the value of this attribute, converted to a double. - bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } - bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } - bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; } + // Get the tinyxml string representation + const TIXML_STRING& NameTStr() const { return name; } - /* Attribute parsing starts: first letter of the name - returns: the next char after the value end quote - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + /** QueryIntValue examines the value string. It is an alternative to the + IntValue() method with richer error checking. + If the value is an integer, it is stored in 'value' and + the call returns TIXML_SUCCESS. If it is not + an integer, it returns TIXML_WRONG_TYPE. - // Prints this Attribute to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const { - Print( cfile, depth, 0 ); - } - void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; + A specialized but useful call. Note that for success it returns 0, + which is the opposite of almost all other TinyXml calls. + */ + int QueryIntValue( int* _value ) const; + /// QueryDoubleValue examines the value string. See QueryIntValue(). + int QueryDoubleValue( double* _value ) const; - // [internal use] - // Set the document pointer so the attribute can report errors. - void SetDocument( TiXmlDocument* doc ) { document = doc; } + void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute. + void SetValue( const char* _value ) { value = _value; } ///< Set the value. + + void SetIntValue( int _value ); ///< Set the value from an integer. + void SetDoubleValue( double _value ); ///< Set the value from a double. + + #ifdef TIXML_USE_STL + /// STL std::string form. + void SetName( const std::string& _name ) { name = _name; } + /// STL std::string form. + void SetValue( const std::string& _value ) { value = _value; } + #endif + + /// Get the next sibling attribute in the DOM. Returns null at end. + const TiXmlAttribute* Next() const; + TiXmlAttribute* Next() { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); + } + + /// Get the previous sibling attribute in the DOM. Returns null at beginning. + const TiXmlAttribute* Previous() const; + TiXmlAttribute* Previous() { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); + } + + bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } + bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } + bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; } + + /* Attribute parsing starts: first letter of the name + returns: the next char after the value end quote + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + // Prints this Attribute to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const { + Print( cfile, depth, 0 ); + } + void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; + + // [internal use] + // Set the document pointer so the attribute can report errors. + void SetDocument( TiXmlDocument* doc ) { document = doc; } private: - TiXmlAttribute( const TiXmlAttribute& ); // not implemented. - void operator=( const TiXmlAttribute& base ); // not allowed. + TiXmlAttribute( const TiXmlAttribute& ); // not implemented. + void operator=( const TiXmlAttribute& base ); // not allowed. - TiXmlDocument* document; // A pointer back to a document, for error reporting. - TIXML_STRING name; - TIXML_STRING value; - TiXmlAttribute* prev; - TiXmlAttribute* next; + TiXmlDocument* document; // A pointer back to a document, for error reporting. + TIXML_STRING name; + TIXML_STRING value; + TiXmlAttribute* prev; + TiXmlAttribute* next; }; -/* A class used to manage a group of attributes. - It is only used internally, both by the ELEMENT and the DECLARATION. - - The set can be changed transparent to the Element and Declaration - classes that use it, but NOT transparent to the Attribute - which has to implement a next() and previous() method. Which makes - it a bit problematic and prevents the use of STL. +/* A class used to manage a group of attributes. + It is only used internally, both by the ELEMENT and the DECLARATION. + + The set can be changed transparent to the Element and Declaration + classes that use it, but NOT transparent to the Attribute + which has to implement a next() and previous() method. Which makes + it a bit problematic and prevents the use of STL. - This version is implemented with circular lists because: - - I like circular lists - - it demonstrates some independence from the (typical) doubly linked list. + This version is implemented with circular lists because: + - I like circular lists + - it demonstrates some independence from the (typical) doubly linked list. */ class TiXmlAttributeSet { public: - TiXmlAttributeSet(); - ~TiXmlAttributeSet(); + TiXmlAttributeSet(); + ~TiXmlAttributeSet(); - void Add( TiXmlAttribute* attribute ); - void Remove( TiXmlAttribute* attribute ); + void Add( TiXmlAttribute* attribute ); + void Remove( TiXmlAttribute* attribute ); - const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } - TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } - const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } - TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } + const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } + TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } + const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } + TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } - TiXmlAttribute* Find( const char* _name ) const; - TiXmlAttribute* FindOrCreate( const char* _name ); + TiXmlAttribute* Find( const char* _name ) const; + TiXmlAttribute* FindOrCreate( const char* _name ); -# ifdef TIXML_USE_STL - TiXmlAttribute* Find( const std::string& _name ) const; - TiXmlAttribute* FindOrCreate( const std::string& _name ); -# endif +# ifdef TIXML_USE_STL + TiXmlAttribute* Find( const std::string& _name ) const; + TiXmlAttribute* FindOrCreate( const std::string& _name ); +# endif private: - //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element), - //*ME: this class must be also use a hidden/disabled copy-constructor !!! - TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed - void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute) + //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element), + //*ME: this class must be also use a hidden/disabled copy-constructor !!! + TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed + void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute) - TiXmlAttribute sentinel; + TiXmlAttribute sentinel; }; /** The element is a container class. It has a value, the element name, - and can contain other elements, text, comments, and unknowns. - Elements also contain an arbitrary number of attributes. + and can contain other elements, text, comments, and unknowns. + Elements also contain an arbitrary number of attributes. */ class TiXmlElement : public TiXmlNode { public: - /// Construct an element. - TiXmlElement (const char * in_value); - - #ifdef TIXML_USE_STL - /// std::string constructor. - TiXmlElement( const std::string& _value ); - #endif - - TiXmlElement( const TiXmlElement& ); - - void operator=( const TiXmlElement& base ); - - virtual ~TiXmlElement(); - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - */ - const char* Attribute( const char* name ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - If the attribute exists and can be converted to an integer, - the integer value will be put in the return 'i', if 'i' - is non-null. - */ - const char* Attribute( const char* name, int* i ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - If the attribute exists and can be converted to an double, - the double value will be put in the return 'd', if 'd' - is non-null. - */ - const char* Attribute( const char* name, double* d ) const; - - /** QueryIntAttribute examines the attribute - it is an alternative to the - Attribute() method with richer error checking. - If the attribute is an integer, it is stored in 'value' and - the call returns TIXML_SUCCESS. If it is not - an integer, it returns TIXML_WRONG_TYPE. If the attribute - does not exist, then TIXML_NO_ATTRIBUTE is returned. - */ - int QueryIntAttribute( const char* name, int* _value ) const; - /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). - int QueryDoubleAttribute( const char* name, double* _value ) const; - /// QueryFloatAttribute examines the attribute - see QueryIntAttribute(). - int QueryFloatAttribute( const char* name, float* _value ) const { - double d; - int result = QueryDoubleAttribute( name, &d ); - if ( result == TIXML_SUCCESS ) { - *_value = (float)d; - } - return result; - } + /// Construct an element. + TiXmlElement (const char * in_value); #ifdef TIXML_USE_STL - /// QueryStringAttribute examines the attribute - see QueryIntAttribute(). - int QueryStringAttribute( const char* name, std::string* _value ) const { - const char* cstr = Attribute( name ); - if ( cstr ) { - *_value = std::string( cstr ); - return TIXML_SUCCESS; - } - return TIXML_NO_ATTRIBUTE; - } + /// std::string constructor. + TiXmlElement( const std::string& _value ); + #endif - /** Template form of the attribute query which will try to read the - attribute into the specified type. Very easy, very powerful, but - be careful to make sure to call this with the correct type. - - NOTE: This method doesn't work correctly for 'string' types that contain spaces. + TiXmlElement( const TiXmlElement& ); - @return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE - */ - template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const - { - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; + void operator=( const TiXmlElement& base ); - std::stringstream sstream( node->ValueStr() ); - sstream >> *outValue; - if ( !sstream.fail() ) - return TIXML_SUCCESS; - return TIXML_WRONG_TYPE; - } + virtual ~TiXmlElement(); - int QueryValueAttribute( const std::string& name, std::string* outValue ) const - { - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - *outValue = node->ValueStr(); - return TIXML_SUCCESS; - } - #endif + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + */ + const char* Attribute( const char* name ) const; - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetAttribute( const char* name, const char * _value ); + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + If the attribute exists and can be converted to an integer, + the integer value will be put in the return 'i', if 'i' + is non-null. + */ + const char* Attribute( const char* name, int* i ) const; + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + If the attribute exists and can be converted to an double, + the double value will be put in the return 'd', if 'd' + is non-null. + */ + const char* Attribute( const char* name, double* d ) const; + + /** QueryIntAttribute examines the attribute - it is an alternative to the + Attribute() method with richer error checking. + If the attribute is an integer, it is stored in 'value' and + the call returns TIXML_SUCCESS. If it is not + an integer, it returns TIXML_WRONG_TYPE. If the attribute + does not exist, then TIXML_NO_ATTRIBUTE is returned. + */ + int QueryIntAttribute( const char* name, int* _value ) const; + /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). + int QueryDoubleAttribute( const char* name, double* _value ) const; + /// QueryFloatAttribute examines the attribute - see QueryIntAttribute(). + int QueryFloatAttribute( const char* name, float* _value ) const { + double d; + int result = QueryDoubleAttribute( name, &d ); + if ( result == TIXML_SUCCESS ) { + *_value = (float)d; + } + return result; + } #ifdef TIXML_USE_STL - const std::string* Attribute( const std::string& name ) const; - const std::string* Attribute( const std::string& name, int* i ) const; - const std::string* Attribute( const std::string& name, double* d ) const; - int QueryIntAttribute( const std::string& name, int* _value ) const; - int QueryDoubleAttribute( const std::string& name, double* _value ) const; + /// QueryStringAttribute examines the attribute - see QueryIntAttribute(). + int QueryStringAttribute( const char* name, std::string* _value ) const { + const char* cstr = Attribute( name ); + if ( cstr ) { + *_value = std::string( cstr ); + return TIXML_SUCCESS; + } + return TIXML_NO_ATTRIBUTE; + } - /// STL std::string form. - void SetAttribute( const std::string& name, const std::string& _value ); - ///< STL std::string form. - void SetAttribute( const std::string& name, int _value ); - ///< STL std::string form. - void SetDoubleAttribute( const std::string& name, double value ); - #endif + /** Template form of the attribute query which will try to read the + attribute into the specified type. Very easy, very powerful, but + be careful to make sure to call this with the correct type. + + NOTE: This method doesn't work correctly for 'string' types that contain spaces. - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetAttribute( const char * name, int value ); + @return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE + */ + template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const + { + const TiXmlAttribute* node = attributeSet.Find( name ); + if ( !node ) + return TIXML_NO_ATTRIBUTE; - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetDoubleAttribute( const char * name, double value ); + std::stringstream sstream( node->ValueStr() ); + sstream >> *outValue; + if ( !sstream.fail() ) + return TIXML_SUCCESS; + return TIXML_WRONG_TYPE; + } + + int QueryValueAttribute( const std::string& name, std::string* outValue ) const + { + const TiXmlAttribute* node = attributeSet.Find( name ); + if ( !node ) + return TIXML_NO_ATTRIBUTE; + *outValue = node->ValueStr(); + return TIXML_SUCCESS; + } + #endif + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetAttribute( const char* name, const char * _value ); - /** Deletes an attribute with the given name. - */ - void RemoveAttribute( const char * name ); #ifdef TIXML_USE_STL - void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); } ///< STL std::string form. - #endif + const std::string* Attribute( const std::string& name ) const; + const std::string* Attribute( const std::string& name, int* i ) const; + const std::string* Attribute( const std::string& name, double* d ) const; + int QueryIntAttribute( const std::string& name, int* _value ) const; + int QueryDoubleAttribute( const std::string& name, double* _value ) const; - const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element. - TiXmlAttribute* FirstAttribute() { return attributeSet.First(); } - const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); } ///< Access the last attribute in this element. - TiXmlAttribute* LastAttribute() { return attributeSet.Last(); } + /// STL std::string form. + void SetAttribute( const std::string& name, const std::string& _value ); + ///< STL std::string form. + void SetAttribute( const std::string& name, int _value ); + ///< STL std::string form. + void SetDoubleAttribute( const std::string& name, double value ); + #endif - /** Convenience function for easy access to the text inside an element. Although easy - and concise, GetText() is limited compared to getting the TiXmlText child - and accessing it directly. - - If the first child of 'this' is a TiXmlText, the GetText() - returns the character string of the Text node, else null is returned. + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetAttribute( const char * name, int value ); - This is a convenient method for getting the text of simple contained text: - @verbatim - This is text - const char* str = fooElement->GetText(); - @endverbatim + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetDoubleAttribute( const char * name, double value ); - 'str' will be a pointer to "This is text". - - Note that this function can be misleading. If the element foo was created from - this XML: - @verbatim - This is text - @endverbatim + /** Deletes an attribute with the given name. + */ + void RemoveAttribute( const char * name ); + #ifdef TIXML_USE_STL + void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); } ///< STL std::string form. + #endif - then the value of str would be null. The first child node isn't a text node, it is - another element. From this XML: - @verbatim - This is text - @endverbatim - GetText() will return "This is ". + const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element. + TiXmlAttribute* FirstAttribute() { return attributeSet.First(); } + const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); } ///< Access the last attribute in this element. + TiXmlAttribute* LastAttribute() { return attributeSet.Last(); } - WARNING: GetText() accesses a child node - don't become confused with the - similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are - safe type casts on the referenced node. - */ - const char* GetText() const; + /** Convenience function for easy access to the text inside an element. Although easy + and concise, GetText() is limited compared to getting the TiXmlText child + and accessing it directly. + + If the first child of 'this' is a TiXmlText, the GetText() + returns the character string of the Text node, else null is returned. - /// Creates a new Element and returns it - the returned element is a copy. - virtual TiXmlNode* Clone() const; - // Print the Element to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; + This is a convenient method for getting the text of simple contained text: + @verbatim + This is text + const char* str = fooElement->GetText(); + @endverbatim - /* Attribtue parsing starts: next char past '<' - returns: next char past '>' - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + 'str' will be a pointer to "This is text". + + Note that this function can be misleading. If the element foo was created from + this XML: + @verbatim + This is text + @endverbatim - virtual const TiXmlElement* ToElement() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlElement* ToElement() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + then the value of str would be null. The first child node isn't a text node, it is + another element. From this XML: + @verbatim + This is text + @endverbatim + GetText() will return "This is ". - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; + WARNING: GetText() accesses a child node - don't become confused with the + similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are + safe type casts on the referenced node. + */ + const char* GetText() const; + + /// Creates a new Element and returns it - the returned element is a copy. + virtual TiXmlNode* Clone() const; + // Print the Element to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; + + /* Attribtue parsing starts: next char past '<' + returns: next char past '>' + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlElement* ToElement() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlElement* ToElement() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* visitor ) const; protected: - void CopyTo( TiXmlElement* target ) const; - void ClearThis(); // like clear, but initializes 'this' object as well + void CopyTo( TiXmlElement* target ) const; + void ClearThis(); // like clear, but initializes 'this' object as well - // Used to be public [internal use] - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - /* [internal use] - Reads the "value" of the element -- another element, or text. - This should terminate with the current end tag. - */ - const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding ); + // Used to be public [internal use] + #ifdef TIXML_USE_STL + virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); + #endif + /* [internal use] + Reads the "value" of the element -- another element, or text. + This should terminate with the current end tag. + */ + const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding ); private: - TiXmlAttributeSet attributeSet; + TiXmlAttributeSet attributeSet; }; -/** An XML comment. +/** An XML comment. */ class TiXmlComment : public TiXmlNode { public: - /// Constructs an empty comment. - TiXmlComment() : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {} - /// Construct a comment from text. - TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) { - SetValue( _value ); - } - TiXmlComment( const TiXmlComment& ); - void operator=( const TiXmlComment& base ); + /// Constructs an empty comment. + TiXmlComment() : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {} + /// Construct a comment from text. + TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) { + SetValue( _value ); + } + TiXmlComment( const TiXmlComment& ); + void operator=( const TiXmlComment& base ); - virtual ~TiXmlComment() {} + virtual ~TiXmlComment() {} - /// Returns a copy of this Comment. - virtual TiXmlNode* Clone() const; - // Write this Comment to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; + /// Returns a copy of this Comment. + virtual TiXmlNode* Clone() const; + // Write this Comment to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; - /* Attribtue parsing starts: at the ! of the !-- - returns: next char past '>' - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + /* Attribtue parsing starts: at the ! of the !-- + returns: next char past '>' + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - virtual const TiXmlComment* ToComment() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlComment* ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual const TiXmlComment* ToComment() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlComment* ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* visitor ) const; protected: - void CopyTo( TiXmlComment* target ) const; + void CopyTo( TiXmlComment* target ) const; - // used to be public - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif -// virtual void StreamOut( TIXML_OSTREAM * out ) const; + // used to be public + #ifdef TIXML_USE_STL + virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); + #endif +// virtual void StreamOut( TIXML_OSTREAM * out ) const; private: @@ -1198,181 +1198,181 @@ private: /** XML text. A text node can have 2 ways to output the next. "normal" output - and CDATA. It will default to the mode it was parsed from the XML file and - you generally want to leave it alone, but you can change the output mode with - SetCDATA() and query it with CDATA(). + and CDATA. It will default to the mode it was parsed from the XML file and + you generally want to leave it alone, but you can change the output mode with + SetCDATA() and query it with CDATA(). */ class TiXmlText : public TiXmlNode { - friend class TiXmlElement; + friend class TiXmlElement; public: - /** Constructor for text element. By default, it is treated as - normal, encoded text. If you want it be output as a CDATA text - element, set the parameter _cdata to 'true' - */ - TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) - { - SetValue( initValue ); - cdata = false; - } - virtual ~TiXmlText() {} + /** Constructor for text element. By default, it is treated as + normal, encoded text. If you want it be output as a CDATA text + element, set the parameter _cdata to 'true' + */ + TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) + { + SetValue( initValue ); + cdata = false; + } + virtual ~TiXmlText() {} - #ifdef TIXML_USE_STL - /// Constructor. - TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) - { - SetValue( initValue ); - cdata = false; - } - #endif + #ifdef TIXML_USE_STL + /// Constructor. + TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) + { + SetValue( initValue ); + cdata = false; + } + #endif - TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TINYXML_TEXT ) { copy.CopyTo( this ); } - void operator=( const TiXmlText& base ) { base.CopyTo( this ); } + TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TINYXML_TEXT ) { copy.CopyTo( this ); } + void operator=( const TiXmlText& base ) { base.CopyTo( this ); } - // Write this text object to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; + // Write this text object to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; - /// Queries whether this represents text using a CDATA section. - bool CDATA() const { return cdata; } - /// Turns on or off a CDATA representation of text. - void SetCDATA( bool _cdata ) { cdata = _cdata; } + /// Queries whether this represents text using a CDATA section. + bool CDATA() const { return cdata; } + /// Turns on or off a CDATA representation of text. + void SetCDATA( bool _cdata ) { cdata = _cdata; } - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - virtual const TiXmlText* ToText() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlText* ToText() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual const TiXmlText* ToText() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlText* ToText() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* content ) const; protected : - /// [internal use] Creates a new Element and returns it. - virtual TiXmlNode* Clone() const; - void CopyTo( TiXmlText* target ) const; + /// [internal use] Creates a new Element and returns it. + virtual TiXmlNode* Clone() const; + void CopyTo( TiXmlText* target ) const; - bool Blank() const; // returns true if all white space and new lines - // [internal use] - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif + bool Blank() const; // returns true if all white space and new lines + // [internal use] + #ifdef TIXML_USE_STL + virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); + #endif private: - bool cdata; // true if this should be input and output as a CDATA style text element + bool cdata; // true if this should be input and output as a CDATA style text element }; /** In correct XML the declaration is the first entry in the file. - @verbatim - - @endverbatim + @verbatim + + @endverbatim - TinyXml will happily read or write files without a declaration, - however. There are 3 possible attributes to the declaration: - version, encoding, and standalone. + TinyXml will happily read or write files without a declaration, + however. There are 3 possible attributes to the declaration: + version, encoding, and standalone. - Note: In this version of the code, the attributes are - handled as special cases, not generic attributes, simply - because there can only be at most 3 and they are always the same. + Note: In this version of the code, the attributes are + handled as special cases, not generic attributes, simply + because there can only be at most 3 and they are always the same. */ class TiXmlDeclaration : public TiXmlNode { public: - /// Construct an empty declaration. - TiXmlDeclaration() : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) {} + /// Construct an empty declaration. + TiXmlDeclaration() : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) {} #ifdef TIXML_USE_STL - /// Constructor. - TiXmlDeclaration( const std::string& _version, - const std::string& _encoding, - const std::string& _standalone ); + /// Constructor. + TiXmlDeclaration( const std::string& _version, + const std::string& _encoding, + const std::string& _standalone ); #endif - /// Construct. - TiXmlDeclaration( const char* _version, - const char* _encoding, - const char* _standalone ); + /// Construct. + TiXmlDeclaration( const char* _version, + const char* _encoding, + const char* _standalone ); - TiXmlDeclaration( const TiXmlDeclaration& copy ); - void operator=( const TiXmlDeclaration& copy ); + TiXmlDeclaration( const TiXmlDeclaration& copy ); + void operator=( const TiXmlDeclaration& copy ); - virtual ~TiXmlDeclaration() {} + virtual ~TiXmlDeclaration() {} - /// Version. Will return an empty string if none was found. - const char *Version() const { return version.c_str (); } - /// Encoding. Will return an empty string if none was found. - const char *Encoding() const { return encoding.c_str (); } - /// Is this a standalone document? - const char *Standalone() const { return standalone.c_str (); } + /// Version. Will return an empty string if none was found. + const char *Version() const { return version.c_str (); } + /// Encoding. Will return an empty string if none was found. + const char *Encoding() const { return encoding.c_str (); } + /// Is this a standalone document? + const char *Standalone() const { return standalone.c_str (); } - /// Creates a copy of this Declaration and returns it. - virtual TiXmlNode* Clone() const; - // Print this declaration to a FILE stream. - virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; - virtual void Print( FILE* cfile, int depth ) const { - Print( cfile, depth, 0 ); - } + /// Creates a copy of this Declaration and returns it. + virtual TiXmlNode* Clone() const; + // Print this declaration to a FILE stream. + virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; + virtual void Print( FILE* cfile, int depth ) const { + Print( cfile, depth, 0 ); + } - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - virtual const TiXmlDeclaration* ToDeclaration() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlDeclaration* ToDeclaration() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual const TiXmlDeclaration* ToDeclaration() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlDeclaration* ToDeclaration() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* visitor ) const; protected: - void CopyTo( TiXmlDeclaration* target ) const; - // used to be public - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif + void CopyTo( TiXmlDeclaration* target ) const; + // used to be public + #ifdef TIXML_USE_STL + virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); + #endif private: - TIXML_STRING version; - TIXML_STRING encoding; - TIXML_STRING standalone; + TIXML_STRING version; + TIXML_STRING encoding; + TIXML_STRING standalone; }; /** Any tag that tinyXml doesn't recognize is saved as an - unknown. It is a tag of text, but should not be modified. - It will be written back to the XML, unchanged, when the file - is saved. + unknown. It is a tag of text, but should not be modified. + It will be written back to the XML, unchanged, when the file + is saved. - DTD tags get thrown into TiXmlUnknowns. + DTD tags get thrown into TiXmlUnknowns. */ class TiXmlUnknown : public TiXmlNode { public: - TiXmlUnknown() : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) {} - virtual ~TiXmlUnknown() {} + TiXmlUnknown() : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) {} + virtual ~TiXmlUnknown() {} - TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) { copy.CopyTo( this ); } - void operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); } + TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) { copy.CopyTo( this ); } + void operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); } - /// Creates a copy of this Unknown and returns it. - virtual TiXmlNode* Clone() const; - // Print this Unknown to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; + /// Creates a copy of this Unknown and returns it. + virtual TiXmlNode* Clone() const; + // Print this Unknown to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - virtual const TiXmlUnknown* ToUnknown() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlUnknown* ToUnknown() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual const TiXmlUnknown* ToUnknown() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlUnknown* ToUnknown() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* content ) const; protected: - void CopyTo( TiXmlUnknown* target ) const; + void CopyTo( TiXmlUnknown* target ) const; - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif + #ifdef TIXML_USE_STL + virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); + #endif private: @@ -1380,414 +1380,414 @@ private: /** Always the top level node. A document binds together all the - XML pieces. It can be saved, loaded, and printed to the screen. - The 'value' of a document node is the xml file name. + XML pieces. It can be saved, loaded, and printed to the screen. + The 'value' of a document node is the xml file name. */ class TiXmlDocument : public TiXmlNode { public: - /// Create an empty document, that has no name. - TiXmlDocument(); - /// Create a document with a name. The name of the document is also the filename of the xml. - TiXmlDocument( const char * documentName ); + /// Create an empty document, that has no name. + TiXmlDocument(); + /// Create a document with a name. The name of the document is also the filename of the xml. + TiXmlDocument( const char * documentName ); - #ifdef TIXML_USE_STL - /// Constructor. - TiXmlDocument( const std::string& documentName ); - #endif + #ifdef TIXML_USE_STL + /// Constructor. + TiXmlDocument( const std::string& documentName ); + #endif - TiXmlDocument( const TiXmlDocument& copy ); - void operator=( const TiXmlDocument& copy ); + TiXmlDocument( const TiXmlDocument& copy ); + void operator=( const TiXmlDocument& copy ); - virtual ~TiXmlDocument() {} + virtual ~TiXmlDocument() {} - /** Load a file using the current document value. - Returns true if successful. Will delete any existing - document data before loading. - */ - bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the current document value. Returns true if successful. - bool SaveFile() const; - /// Load a file using the given filename. Returns true if successful. - bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the given filename. Returns true if successful. - bool SaveFile( const char * filename ) const; - /** Load a file using the given FILE*. Returns true if successful. Note that this method - doesn't stream - the entire object pointed at by the FILE* - will be interpreted as an XML file. TinyXML doesn't stream in XML from the current - file location. Streaming may be added in the future. - */ - bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the given FILE*. Returns true if successful. - bool SaveFile( FILE* ) const; + /** Load a file using the current document value. + Returns true if successful. Will delete any existing + document data before loading. + */ + bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + /// Save a file using the current document value. Returns true if successful. + bool SaveFile() const; + /// Load a file using the given filename. Returns true if successful. + bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + /// Save a file using the given filename. Returns true if successful. + bool SaveFile( const char * filename ) const; + /** Load a file using the given FILE*. Returns true if successful. Note that this method + doesn't stream - the entire object pointed at by the FILE* + will be interpreted as an XML file. TinyXML doesn't stream in XML from the current + file location. Streaming may be added in the future. + */ + bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + /// Save a file using the given FILE*. Returns true if successful. + bool SaveFile( FILE* ) const; - #ifdef TIXML_USE_STL - bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) ///< STL std::string version. - { - return LoadFile( filename.c_str(), encoding ); - } - bool SaveFile( const std::string& filename ) const ///< STL std::string version. - { - return SaveFile( filename.c_str() ); - } - #endif + #ifdef TIXML_USE_STL + bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) ///< STL std::string version. + { + return LoadFile( filename.c_str(), encoding ); + } + bool SaveFile( const std::string& filename ) const ///< STL std::string version. + { + return SaveFile( filename.c_str() ); + } + #endif - /** Parse the given null terminated block of xml data. Passing in an encoding to this - method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml - to use that encoding, regardless of what TinyXml might otherwise try to detect. - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + /** Parse the given null terminated block of xml data. Passing in an encoding to this + method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml + to use that encoding, regardless of what TinyXml might otherwise try to detect. + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /** Get the root element -- the only top level element -- of the document. - In well formed XML, there should only be one. TinyXml is tolerant of - multiple elements at the document level. - */ - const TiXmlElement* RootElement() const { return FirstChildElement(); } - TiXmlElement* RootElement() { return FirstChildElement(); } + /** Get the root element -- the only top level element -- of the document. + In well formed XML, there should only be one. TinyXml is tolerant of + multiple elements at the document level. + */ + const TiXmlElement* RootElement() const { return FirstChildElement(); } + TiXmlElement* RootElement() { return FirstChildElement(); } - /** If an error occurs, Error will be set to true. Also, - - The ErrorId() will contain the integer identifier of the error (not generally useful) - - The ErrorDesc() method will return the name of the error. (very useful) - - The ErrorRow() and ErrorCol() will return the location of the error (if known) - */ - bool Error() const { return error; } + /** If an error occurs, Error will be set to true. Also, + - The ErrorId() will contain the integer identifier of the error (not generally useful) + - The ErrorDesc() method will return the name of the error. (very useful) + - The ErrorRow() and ErrorCol() will return the location of the error (if known) + */ + bool Error() const { return error; } - /// Contains a textual (english) description of the error if one occurs. - const char * ErrorDesc() const { return errorDesc.c_str (); } + /// Contains a textual (english) description of the error if one occurs. + const char * ErrorDesc() const { return errorDesc.c_str (); } - /** Generally, you probably want the error string ( ErrorDesc() ). But if you - prefer the ErrorId, this function will fetch it. - */ - int ErrorId() const { return errorId; } + /** Generally, you probably want the error string ( ErrorDesc() ). But if you + prefer the ErrorId, this function will fetch it. + */ + int ErrorId() const { return errorId; } - /** Returns the location (if known) of the error. The first column is column 1, - and the first row is row 1. A value of 0 means the row and column wasn't applicable - (memory errors, for example, have no row/column) or the parser lost the error. (An - error in the error reporting, in that case.) + /** Returns the location (if known) of the error. The first column is column 1, + and the first row is row 1. A value of 0 means the row and column wasn't applicable + (memory errors, for example, have no row/column) or the parser lost the error. (An + error in the error reporting, in that case.) - @sa SetTabSize, Row, Column - */ - int ErrorRow() const { return errorLocation.row+1; } - int ErrorCol() const { return errorLocation.col+1; } ///< The column where the error occured. See ErrorRow() + @sa SetTabSize, Row, Column + */ + int ErrorRow() const { return errorLocation.row+1; } + int ErrorCol() const { return errorLocation.col+1; } ///< The column where the error occured. See ErrorRow() - /** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) - to report the correct values for row and column. It does not change the output - or input in any way. - - By calling this method, with a tab size - greater than 0, the row and column of each node and attribute is stored - when the file is loaded. Very useful for tracking the DOM back in to - the source file. + /** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) + to report the correct values for row and column. It does not change the output + or input in any way. + + By calling this method, with a tab size + greater than 0, the row and column of each node and attribute is stored + when the file is loaded. Very useful for tracking the DOM back in to + the source file. - The tab size is required for calculating the location of nodes. If not - set, the default of 4 is used. The tabsize is set per document. Setting - the tabsize to 0 disables row/column tracking. + The tab size is required for calculating the location of nodes. If not + set, the default of 4 is used. The tabsize is set per document. Setting + the tabsize to 0 disables row/column tracking. - Note that row and column tracking is not supported when using operator>>. + Note that row and column tracking is not supported when using operator>>. - The tab size needs to be enabled before the parse or load. Correct usage: - @verbatim - TiXmlDocument doc; - doc.SetTabSize( 8 ); - doc.Load( "myfile.xml" ); - @endverbatim + The tab size needs to be enabled before the parse or load. Correct usage: + @verbatim + TiXmlDocument doc; + doc.SetTabSize( 8 ); + doc.Load( "myfile.xml" ); + @endverbatim - @sa Row, Column - */ - void SetTabSize( int _tabsize ) { tabsize = _tabsize; } + @sa Row, Column + */ + void SetTabSize( int _tabsize ) { tabsize = _tabsize; } - int TabSize() const { return tabsize; } + int TabSize() const { return tabsize; } - /** If you have handled the error, it can be reset with this call. The error - state is automatically cleared if you Parse a new XML block. - */ - void ClearError() { error = false; - errorId = 0; - errorDesc = ""; - errorLocation.row = errorLocation.col = 0; - //errorLocation.last = 0; - } + /** If you have handled the error, it can be reset with this call. The error + state is automatically cleared if you Parse a new XML block. + */ + void ClearError() { error = false; + errorId = 0; + errorDesc = ""; + errorLocation.row = errorLocation.col = 0; + //errorLocation.last = 0; + } - /** Write the document to standard out using formatted printing ("pretty print"). */ - void Print() const { Print( stdout, 0 ); } + /** Write the document to standard out using formatted printing ("pretty print"). */ + void Print() const { Print( stdout, 0 ); } - /* Write the document to a string using formatted printing ("pretty print"). This - will allocate a character array (new char[]) and return it as a pointer. The - calling code pust call delete[] on the return char* to avoid a memory leak. - */ - //char* PrintToMemory() const; + /* Write the document to a string using formatted printing ("pretty print"). This + will allocate a character array (new char[]) and return it as a pointer. The + calling code pust call delete[] on the return char* to avoid a memory leak. + */ + //char* PrintToMemory() const; - /// Print this Document to a FILE stream. - virtual void Print( FILE* cfile, int depth = 0 ) const; - // [internal use] - void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding ); + /// Print this Document to a FILE stream. + virtual void Print( FILE* cfile, int depth = 0 ) const; + // [internal use] + void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding ); - virtual const TiXmlDocument* ToDocument() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlDocument* ToDocument() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual const TiXmlDocument* ToDocument() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlDocument* ToDocument() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* content ) const; protected : - // [internal use] - virtual TiXmlNode* Clone() const; - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif + // [internal use] + virtual TiXmlNode* Clone() const; + #ifdef TIXML_USE_STL + virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); + #endif private: - void CopyTo( TiXmlDocument* target ) const; + void CopyTo( TiXmlDocument* target ) const; - bool error; - int errorId; - TIXML_STRING errorDesc; - int tabsize; - TiXmlCursor errorLocation; - bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write. + bool error; + int errorId; + TIXML_STRING errorDesc; + int tabsize; + TiXmlCursor errorLocation; + bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write. }; /** - A TiXmlHandle is a class that wraps a node pointer with null checks; this is - an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml - DOM structure. It is a separate utility class. + A TiXmlHandle is a class that wraps a node pointer with null checks; this is + an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml + DOM structure. It is a separate utility class. - Take an example: - @verbatim - - - - - - - @endverbatim + Take an example: + @verbatim + + + + + + + @endverbatim - Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very - easy to write a *lot* of code that looks like: + Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very + easy to write a *lot* of code that looks like: - @verbatim - TiXmlElement* root = document.FirstChildElement( "Document" ); - if ( root ) - { - TiXmlElement* element = root->FirstChildElement( "Element" ); - if ( element ) - { - TiXmlElement* child = element->FirstChildElement( "Child" ); - if ( child ) - { - TiXmlElement* child2 = child->NextSiblingElement( "Child" ); - if ( child2 ) - { - // Finally do something useful. - @endverbatim + @verbatim + TiXmlElement* root = document.FirstChildElement( "Document" ); + if ( root ) + { + TiXmlElement* element = root->FirstChildElement( "Element" ); + if ( element ) + { + TiXmlElement* child = element->FirstChildElement( "Child" ); + if ( child ) + { + TiXmlElement* child2 = child->NextSiblingElement( "Child" ); + if ( child2 ) + { + // Finally do something useful. + @endverbatim - And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity - of such code. A TiXmlHandle checks for null pointers so it is perfectly safe - and correct to use: + And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity + of such code. A TiXmlHandle checks for null pointers so it is perfectly safe + and correct to use: - @verbatim - TiXmlHandle docHandle( &document ); - TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement(); - if ( child2 ) - { - // do something useful - @endverbatim + @verbatim + TiXmlHandle docHandle( &document ); + TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement(); + if ( child2 ) + { + // do something useful + @endverbatim - Which is MUCH more concise and useful. + Which is MUCH more concise and useful. - It is also safe to copy handles - internally they are nothing more than node pointers. - @verbatim - TiXmlHandle handleCopy = handle; - @endverbatim + It is also safe to copy handles - internally they are nothing more than node pointers. + @verbatim + TiXmlHandle handleCopy = handle; + @endverbatim - What they should not be used for is iteration: + What they should not be used for is iteration: - @verbatim - int i=0; - while ( true ) - { - TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement(); - if ( !child ) - break; - // do something - ++i; - } - @endverbatim + @verbatim + int i=0; + while ( true ) + { + TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement(); + if ( !child ) + break; + // do something + ++i; + } + @endverbatim - It seems reasonable, but it is in fact two embedded while loops. The Child method is - a linear walk to find the element, so this code would iterate much more than it needs - to. Instead, prefer: + It seems reasonable, but it is in fact two embedded while loops. The Child method is + a linear walk to find the element, so this code would iterate much more than it needs + to. Instead, prefer: - @verbatim - TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).ToElement(); + @verbatim + TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).ToElement(); - for( child; child; child=child->NextSiblingElement() ) - { - // do something - } - @endverbatim + for( child; child; child=child->NextSiblingElement() ) + { + // do something + } + @endverbatim */ class TiXmlHandle { public: - /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. - TiXmlHandle( TiXmlNode* _node ) { this->node = _node; } - /// Copy constructor - TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; } - TiXmlHandle operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; } + /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. + TiXmlHandle( TiXmlNode* _node ) { this->node = _node; } + /// Copy constructor + TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; } + TiXmlHandle operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; } - /// Return a handle to the first child node. - TiXmlHandle FirstChild() const; - /// Return a handle to the first child node with the given name. - TiXmlHandle FirstChild( const char * value ) const; - /// Return a handle to the first child element. - TiXmlHandle FirstChildElement() const; - /// Return a handle to the first child element with the given name. - TiXmlHandle FirstChildElement( const char * value ) const; + /// Return a handle to the first child node. + TiXmlHandle FirstChild() const; + /// Return a handle to the first child node with the given name. + TiXmlHandle FirstChild( const char * value ) const; + /// Return a handle to the first child element. + TiXmlHandle FirstChildElement() const; + /// Return a handle to the first child element with the given name. + TiXmlHandle FirstChildElement( const char * value ) const; - /** Return a handle to the "index" child with the given name. - The first child is 0, the second 1, etc. - */ - TiXmlHandle Child( const char* value, int index ) const; - /** Return a handle to the "index" child. - The first child is 0, the second 1, etc. - */ - TiXmlHandle Child( int index ) const; - /** Return a handle to the "index" child element with the given name. - The first child element is 0, the second 1, etc. Note that only TiXmlElements - are indexed: other types are not counted. - */ - TiXmlHandle ChildElement( const char* value, int index ) const; - /** Return a handle to the "index" child element. - The first child element is 0, the second 1, etc. Note that only TiXmlElements - are indexed: other types are not counted. - */ - TiXmlHandle ChildElement( int index ) const; + /** Return a handle to the "index" child with the given name. + The first child is 0, the second 1, etc. + */ + TiXmlHandle Child( const char* value, int index ) const; + /** Return a handle to the "index" child. + The first child is 0, the second 1, etc. + */ + TiXmlHandle Child( int index ) const; + /** Return a handle to the "index" child element with the given name. + The first child element is 0, the second 1, etc. Note that only TiXmlElements + are indexed: other types are not counted. + */ + TiXmlHandle ChildElement( const char* value, int index ) const; + /** Return a handle to the "index" child element. + The first child element is 0, the second 1, etc. Note that only TiXmlElements + are indexed: other types are not counted. + */ + TiXmlHandle ChildElement( int index ) const; - #ifdef TIXML_USE_STL - TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); } - TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); } + #ifdef TIXML_USE_STL + TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); } + TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); } - TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); } - TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); } - #endif + TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); } + TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); } + #endif - /** Return the handle as a TiXmlNode. This may return null. - */ - TiXmlNode* ToNode() const { return node; } - /** Return the handle as a TiXmlElement. This may return null. - */ - TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); } - /** Return the handle as a TiXmlText. This may return null. - */ - TiXmlText* ToText() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); } - /** Return the handle as a TiXmlUnknown. This may return null. - */ - TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); } + /** Return the handle as a TiXmlNode. This may return null. + */ + TiXmlNode* ToNode() const { return node; } + /** Return the handle as a TiXmlElement. This may return null. + */ + TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); } + /** Return the handle as a TiXmlText. This may return null. + */ + TiXmlText* ToText() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); } + /** Return the handle as a TiXmlUnknown. This may return null. + */ + TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); } - /** @deprecated use ToNode. - Return the handle as a TiXmlNode. This may return null. - */ - TiXmlNode* Node() const { return ToNode(); } - /** @deprecated use ToElement. - Return the handle as a TiXmlElement. This may return null. - */ - TiXmlElement* Element() const { return ToElement(); } - /** @deprecated use ToText() - Return the handle as a TiXmlText. This may return null. - */ - TiXmlText* Text() const { return ToText(); } - /** @deprecated use ToUnknown() - Return the handle as a TiXmlUnknown. This may return null. - */ - TiXmlUnknown* Unknown() const { return ToUnknown(); } + /** @deprecated use ToNode. + Return the handle as a TiXmlNode. This may return null. + */ + TiXmlNode* Node() const { return ToNode(); } + /** @deprecated use ToElement. + Return the handle as a TiXmlElement. This may return null. + */ + TiXmlElement* Element() const { return ToElement(); } + /** @deprecated use ToText() + Return the handle as a TiXmlText. This may return null. + */ + TiXmlText* Text() const { return ToText(); } + /** @deprecated use ToUnknown() + Return the handle as a TiXmlUnknown. This may return null. + */ + TiXmlUnknown* Unknown() const { return ToUnknown(); } private: - TiXmlNode* node; + TiXmlNode* node; }; /** Print to memory functionality. The TiXmlPrinter is useful when you need to: - -# Print to memory (especially in non-STL mode) - -# Control formatting (line endings, etc.) + -# Print to memory (especially in non-STL mode) + -# Control formatting (line endings, etc.) - When constructed, the TiXmlPrinter is in its default "pretty printing" mode. - Before calling Accept() you can call methods to control the printing - of the XML document. After TiXmlNode::Accept() is called, the printed document can - be accessed via the CStr(), Str(), and Size() methods. + When constructed, the TiXmlPrinter is in its default "pretty printing" mode. + Before calling Accept() you can call methods to control the printing + of the XML document. After TiXmlNode::Accept() is called, the printed document can + be accessed via the CStr(), Str(), and Size() methods. - TiXmlPrinter uses the Visitor API. - @verbatim - TiXmlPrinter printer; - printer.SetIndent( "\t" ); + TiXmlPrinter uses the Visitor API. + @verbatim + TiXmlPrinter printer; + printer.SetIndent( "\t" ); - doc.Accept( &printer ); - fprintf( stdout, "%s", printer.CStr() ); - @endverbatim + doc.Accept( &printer ); + fprintf( stdout, "%s", printer.CStr() ); + @endverbatim */ class TiXmlPrinter : public TiXmlVisitor { public: - TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ), - buffer(), indent( " " ), lineBreak( "\n" ) {} + TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ), + buffer(), indent( " " ), lineBreak( "\n" ) {} - virtual bool VisitEnter( const TiXmlDocument& doc ); - virtual bool VisitExit( const TiXmlDocument& doc ); + virtual bool VisitEnter( const TiXmlDocument& doc ); + virtual bool VisitExit( const TiXmlDocument& doc ); - virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ); - virtual bool VisitExit( const TiXmlElement& element ); + virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ); + virtual bool VisitExit( const TiXmlElement& element ); - virtual bool Visit( const TiXmlDeclaration& declaration ); - virtual bool Visit( const TiXmlText& text ); - virtual bool Visit( const TiXmlComment& comment ); - virtual bool Visit( const TiXmlUnknown& unknown ); + virtual bool Visit( const TiXmlDeclaration& declaration ); + virtual bool Visit( const TiXmlText& text ); + virtual bool Visit( const TiXmlComment& comment ); + virtual bool Visit( const TiXmlUnknown& unknown ); - /** Set the indent characters for printing. By default 4 spaces - but tab (\t) is also useful, or null/empty string for no indentation. - */ - void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; } - /// Query the indention string. - const char* Indent() { return indent.c_str(); } - /** Set the line breaking string. By default set to newline (\n). - Some operating systems prefer other characters, or can be - set to the null/empty string for no indenation. - */ - void SetLineBreak( const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak : ""; } - /// Query the current line breaking string. - const char* LineBreak() { return lineBreak.c_str(); } + /** Set the indent characters for printing. By default 4 spaces + but tab (\t) is also useful, or null/empty string for no indentation. + */ + void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; } + /// Query the indention string. + const char* Indent() { return indent.c_str(); } + /** Set the line breaking string. By default set to newline (\n). + Some operating systems prefer other characters, or can be + set to the null/empty string for no indenation. + */ + void SetLineBreak( const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak : ""; } + /// Query the current line breaking string. + const char* LineBreak() { return lineBreak.c_str(); } - /** Switch over to "stream printing" which is the most dense formatting without - linebreaks. Common when the XML is needed for network transmission. - */ - void SetStreamPrinting() { indent = ""; - lineBreak = ""; - } - /// Return the result. - const char* CStr() { return buffer.c_str(); } - /// Return the length of the result string. - size_t Size() { return buffer.size(); } + /** Switch over to "stream printing" which is the most dense formatting without + linebreaks. Common when the XML is needed for network transmission. + */ + void SetStreamPrinting() { indent = ""; + lineBreak = ""; + } + /// Return the result. + const char* CStr() { return buffer.c_str(); } + /// Return the length of the result string. + size_t Size() { return buffer.size(); } - #ifdef TIXML_USE_STL - /// Return the result. - const std::string& Str() { return buffer; } - #endif + #ifdef TIXML_USE_STL + /// Return the result. + const std::string& Str() { return buffer; } + #endif private: - void DoIndent() { - for( int i=0; iget_bface_flag()) { - pnode->set_double_sided(true); + pnode->set_double_sided(true); } } } diff --git a/panda/src/gobj/config_gobj.cxx b/panda/src/gobj/config_gobj.cxx index 7a1ead2663..da60a9dfde 100644 --- a/panda/src/gobj/config_gobj.cxx +++ b/panda/src/gobj/config_gobj.cxx @@ -574,9 +574,9 @@ operator >> (istream &in, AutoTextureScale &ats) { ats = ATS_none; } else if (cmp_nocase(word, "down") == 0 || - cmp_nocase(word, "1") == 0 || - cmp_nocase(word, "#t") == 0 || - (!word.empty() && tolower(word[0]) == 't')) { + cmp_nocase(word, "1") == 0 || + cmp_nocase(word, "#t") == 0 || + (!word.empty() && tolower(word[0]) == 't')) { ats = ATS_down; } else if (cmp_nocase(word, "up") == 0) { @@ -624,9 +624,9 @@ operator >> (istream &in, ShaderUtilization &sgc) { sgc = SUT_none; } else if (cmp_nocase(word, "basic") == 0 || - cmp_nocase(word, "1") == 0 || - cmp_nocase(word, "#t") == 0 || - (!word.empty() && tolower(word[0]) == 't')) { + cmp_nocase(word, "1") == 0 || + cmp_nocase(word, "#t") == 0 || + (!word.empty() && tolower(word[0]) == 't')) { sgc = SUT_basic; } else if (cmp_nocase(word, "advanced") == 0) { diff --git a/panda/src/gobj/geomVertexFormat.cxx b/panda/src/gobj/geomVertexFormat.cxx index 7450fcae6d..f391141dbd 100644 --- a/panda/src/gobj/geomVertexFormat.cxx +++ b/panda/src/gobj/geomVertexFormat.cxx @@ -724,7 +724,7 @@ do_register() { if (array_format->get_num_columns() == 0) { // Don't keep an empty array. gobj_cat.warning() - << "Dropping empty array from GeomVertexFormat.\n"; + << "Dropping empty array from GeomVertexFormat.\n"; continue; } @@ -1075,8 +1075,8 @@ register_format(GeomVertexFormat *format) { if (!new_format->is_registered()) { new_format->do_register(); if (new_format->get_num_arrays() == 0) { - gobj_cat.warning() - << "Empty GeomVertexFormat registered.\n"; + gobj_cat.warning() + << "Empty GeomVertexFormat registered.\n"; } } } diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index 8ebb46a4ab..5d7c3952fc 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -6867,7 +6867,7 @@ do_write_datagram_header(BamWriter *manager, Datagram &me, bool &has_rawdata) { // disk. BamWriter::BamTextureMode file_texture_mode = manager->get_file_texture_mode(); has_rawdata = (file_texture_mode == BamWriter::BTM_rawdata || - (_filename.empty() && do_has_bam_rawdata())); + (_filename.empty() && do_has_bam_rawdata())); if (has_rawdata && !do_has_bam_rawdata()) { do_get_bam_rawdata(); if (!do_has_bam_rawdata()) { @@ -7129,8 +7129,8 @@ make_this_from_bam(const FactoryParams ¶ms) { if (me != (Texture *)NULL) { { - MutexHolder holder(me->_lock); - me->do_fillin_from(dummy); + MutexHolder holder(me->_lock); + me->do_fillin_from(dummy); } me->set_name(name); diff --git a/panda/src/gobj/texturePool.cxx b/panda/src/gobj/texturePool.cxx index 4f16661197..08aaeb0c16 100644 --- a/panda/src/gobj/texturePool.cxx +++ b/panda/src/gobj/texturePool.cxx @@ -275,15 +275,15 @@ ns_load_texture(const Filename &orig_filename, int primary_file_num_channels, filename.set_binary(); PT(VirtualFile) file = vfs->get_file(filename); if (file == (VirtualFile *)NULL) { - // No such file. - gobj_cat.error() - << "Could not find " << filename << "\n"; - return false; + // No such file. + gobj_cat.error() + << "Could not find " << filename << "\n"; + return false; } if (gobj_cat.is_debug()) { - gobj_cat.debug() - << "Reading texture object " << filename << "\n"; + gobj_cat.debug() + << "Reading texture object " << filename << "\n"; } istream *in = file->open_read_file(true); @@ -291,20 +291,20 @@ ns_load_texture(const Filename &orig_filename, int primary_file_num_channels, vfs->close_read_file(in); if (tex == (Texture *)NULL) { - return false; + return false; } tex->set_fullpath(filename); tex->clear_alpha_fullpath(); tex->set_keep_ram_image(false); - + } else { // Read it the conventional way. tex = make_texture(ext); if (!tex->read(filename, Filename(), primary_file_num_channels, 0, - 0, 0, false, read_mipmaps, record, options)) { - // This texture was not found or could not be read. - report_texture_unreadable(filename); - return NULL; + 0, 0, false, read_mipmaps, record, options)) { + // This texture was not found or could not be read. + report_texture_unreadable(filename); + return NULL; } } diff --git a/panda/src/grutil/ffmpegTexture.cxx b/panda/src/grutil/ffmpegTexture.cxx index faaaa26f68..a48559196e 100644 --- a/panda/src/grutil/ffmpegTexture.cxx +++ b/panda/src/grutil/ffmpegTexture.cxx @@ -144,7 +144,7 @@ do_reconsider_video_properties(const FFMpegTexture::VideoStream &stream, if (grutil_cat.is_debug()) { grutil_cat.debug() << "Loaded " << stream._filename << ", " - << num_frames << " frames at " << frame_rate << " fps\n"; + << num_frames << " frames at " << frame_rate << " fps\n"; } } diff --git a/panda/src/grutil/geoMipTerrain.I b/panda/src/grutil/geoMipTerrain.I index 682f62a2b3..5e5745a543 100644 --- a/panda/src/grutil/geoMipTerrain.I +++ b/panda/src/grutil/geoMipTerrain.I @@ -343,7 +343,7 @@ set_far(double input_far) { // Function: GeoMipTerrain::get_far // Access: Published // Description: Returns the far LOD distance in the terrain coordinate -// space +// space //////////////////////////////////////////////////////////////////// INLINE double GeoMipTerrain:: get_far() { @@ -354,7 +354,7 @@ get_far() { // Function: GeoMipTerrain::get_near // Access: Published // Description: Returns the near LOD distance in the terrain coordinate -// space +// space //////////////////////////////////////////////////////////////////// INLINE double GeoMipTerrain:: get_near() { diff --git a/panda/src/grutil/geoMipTerrain.cxx b/panda/src/grutil/geoMipTerrain.cxx index f930ea8697..db15b8aef9 100644 --- a/panda/src/grutil/geoMipTerrain.cxx +++ b/panda/src/grutil/geoMipTerrain.cxx @@ -629,9 +629,9 @@ set_heightfield(const Filename &filename, PNMFileType *ftype) { // If it's not a valid size, tell PNMImage to resize it. if (reqx != (unsigned int)imgheader.get_x_size() || reqy != (unsigned int)imgheader.get_y_size()) { grutil_cat.warning() - << "Rescaling heightfield image " << filename - << " from " << imgheader.get_x_size() << "x" << imgheader.get_y_size() - << " to " << reqx << "x" << reqy << " pixels.\n"; + << "Rescaling heightfield image " << filename + << " from " << imgheader.get_x_size() << "x" << imgheader.get_y_size() + << " to " << reqx << "x" << reqy << " pixels.\n"; _heightfield.set_read_size(reqx, reqy); } } diff --git a/panda/src/grutil/meshDrawer.cxx b/panda/src/grutil/meshDrawer.cxx index aac0c052ee..5f0c6fa8c3 100644 --- a/panda/src/grutil/meshDrawer.cxx +++ b/panda/src/grutil/meshDrawer.cxx @@ -416,7 +416,7 @@ void MeshDrawer::geometry(NodePath draw_node) { prim_vertex_reader->set_row_unsafe(vidx); prim_uv_reader->set_row_unsafe(vidx); vec[indx_over] = _render.get_relative_point( - current_node_path,prim_vertex_reader->get_data3f()); + current_node_path,prim_vertex_reader->get_data3f()); uv[indx_over] = prim_uv_reader->get_data2f(); indx_over++; if (indx_over > 2) break; @@ -424,8 +424,8 @@ void MeshDrawer::geometry(NodePath draw_node) { // draw polygon tri(vec[0],color,uv[0], - vec[1],color,uv[1], - vec[2],color,uv[2]); + vec[1],color,uv[1], + vec[2],color,uv[2]); } // if we are over budget just quit if( _clear_index > _end_clear_index) return; @@ -449,7 +449,7 @@ void MeshDrawer::geometry(NodePath draw_node) { //////////////////////////////////////////////////////////////////// void MeshDrawer:: link_segment(LVector3f pos, LVector4f frame, - float thickness, LVector4f color) { + float thickness, LVector4f color) { assert(_render.get_error_type() == NodePath::ET_ok); assert(_camera.get_error_type() == NodePath::ET_ok); /* diff --git a/panda/src/movies/ffmpegVideoCursor.cxx b/panda/src/movies/ffmpegVideoCursor.cxx index 44c555ae08..ef9e9977ad 100644 --- a/panda/src/movies/ffmpegVideoCursor.cxx +++ b/panda/src/movies/ffmpegVideoCursor.cxx @@ -67,7 +67,7 @@ init_from(FfmpegVideo *source) { // Read a subfile. if (!_ffvfile.open_subfile(_source->get_subfile_info())) { movies_cat.info() - << "Couldn't open " << _source->get_subfile_info() << "\n"; + << "Couldn't open " << _source->get_subfile_info() << "\n"; cleanup(); return; } @@ -76,7 +76,7 @@ init_from(FfmpegVideo *source) { // Read a filename. if (!_ffvfile.open_vfs(_filename)) { movies_cat.info() - << "Couldn't open " << _filename << "\n"; + << "Couldn't open " << _filename << "\n"; cleanup(); return; } diff --git a/panda/src/net/datagramGeneratorNet.cxx b/panda/src/net/datagramGeneratorNet.cxx index 527d248d91..963d59985e 100644 --- a/panda/src/net/datagramGeneratorNet.cxx +++ b/panda/src/net/datagramGeneratorNet.cxx @@ -68,7 +68,7 @@ get_datagram(Datagram &data) { net_cat.spam() << "DatagramGeneratorNet returning EOF\n"; } - return false; + return false; } poll(); Thread::force_yield(); @@ -86,7 +86,7 @@ get_datagram(Datagram &data) { net_cat.spam() << "DatagramGeneratorNet returning EOF\n"; } - return false; + return false; } if (net_cat.is_spam()) { net_cat.spam() diff --git a/panda/src/pgraph/portalNode.cxx b/panda/src/pgraph/portalNode.cxx index 531ab6bafe..998301b345 100755 --- a/panda/src/pgraph/portalNode.cxx +++ b/panda/src/pgraph/portalNode.cxx @@ -268,7 +268,7 @@ cull_callback(CullTraverser *trav, CullTraverserData &data) { CPT(TransformState) temp_frustum_transform = data._node_path.get_node_path().get_net_transform()->invert_compose(portal_viewer->_scene_setup->get_cull_center().get_net_transform()); portal_cat.spam() << "clipping plane frustum transform " << *temp_frustum_transform << endl; - portal_cat.spam() << "frustum before transform " << *temp_bh << endl; + portal_cat.spam() << "frustum before transform " << *temp_bh << endl; // transform to portalNode space temp_bh->xform(temp_frustum_transform->get_mat()); diff --git a/panda/src/pgraphnodes/shaderGenerator.cxx b/panda/src/pgraphnodes/shaderGenerator.cxx index e7e9bdde47..1830714068 100644 --- a/panda/src/pgraphnodes/shaderGenerator.cxx +++ b/panda/src/pgraphnodes/shaderGenerator.cxx @@ -311,19 +311,19 @@ analyze_renderstate(const RenderState *rs) { if (tex_gen->has_stage(stage)) { switch (tex_gen->get_mode(stage)) { case TexGenAttrib::M_world_position: - _need_world_position = true; - break; + _need_world_position = true; + break; case TexGenAttrib::M_world_normal: - _need_world_normal = true; - break; + _need_world_normal = true; + break; case TexGenAttrib::M_eye_position: - _need_eye_position = true; - break; + _need_eye_position = true; + break; case TexGenAttrib::M_eye_normal: - _need_eye_normal = true; - break; + _need_eye_normal = true; + break; default: - break; + break; } } } @@ -964,16 +964,16 @@ synthesize_shader(const RenderState *rs) { switch(tex->get_texture_type()) { case Texture::TT_cube_map: case Texture::TT_3d_texture: - text << "xyz"; - break; + text << "xyz"; + break; case Texture::TT_2d_texture: - text << "xy"; - break; + text << "xy"; + break; case Texture::TT_1d_texture: - text << "x"; - break; + text << "x"; + break; default: - break; + break; } text << ");\n"; } diff --git a/panda/src/putil/bamReader.cxx b/panda/src/putil/bamReader.cxx index aee52d2968..857fc534d5 100644 --- a/panda/src/putil/bamReader.cxx +++ b/panda/src/putil/bamReader.cxx @@ -1214,9 +1214,9 @@ p_read_object() { { SubfileInfo info; if (!_source->save_datagram(info)) { - bam_cat.error() - << "Failed to read file data.\n"; - return 0; + bam_cat.error() + << "Failed to read file data.\n"; + return 0; } _file_data_records.push_back(info); } diff --git a/panda/src/putil/datagramInputFile.cxx b/panda/src/putil/datagramInputFile.cxx index 66520ffd80..5c41470a9d 100644 --- a/panda/src/putil/datagramInputFile.cxx +++ b/panda/src/putil/datagramInputFile.cxx @@ -246,8 +246,8 @@ save_datagram(SubfileInfo &info) { out.write(buffer, count); if (out.fail()) { util_cat.error() - << "Couldn't write " << num_bytes << " bytes to " - << tfile->get_filename() << "\n"; + << "Couldn't write " << num_bytes << " bytes to " + << tfile->get_filename() << "\n"; return false; } num_remaining -= count; diff --git a/panda/src/speedtree/config_speedtree.cxx b/panda/src/speedtree/config_speedtree.cxx index 3591ecdaf0..6f2eed9d30 100644 --- a/panda/src/speedtree/config_speedtree.cxx +++ b/panda/src/speedtree/config_speedtree.cxx @@ -37,17 +37,17 @@ ConfigVariableString speedtree_license ConfigVariableFilename speedtree_shaders_dir ("speedtree-shaders-dir", Filename(Filename::from_os_specific(SPEEDTREE_BIN_DIR), "Shaders"), PRC_DESC("Specifies the directory in which to locate SpeedTree's system " - "shaders at runtime. If this is empty, the default is based on " - "SPEEDTREE_BIN_DIR, as provided at compile time.")); + "shaders at runtime. If this is empty, the default is based on " + "SPEEDTREE_BIN_DIR, as provided at compile time.")); #endif // CPPPARSER ConfigVariableFilename speedtree_textures_dir ("speedtree-textures-dir", "", PRC_DESC("Specifies the directory in which to locate textures referenced " - "by SRT files at runtime. The default is to search in the same " - "directory as the SRT file itself. Unfortunately, the model-path " - "cannot be searched, because SpeedTree only provides a single " - "directory option.")); + "by SRT files at runtime. The default is to search in the same " + "directory as the SRT file itself. Unfortunately, the model-path " + "cannot be searched, because SpeedTree only provides a single " + "directory option.")); ConfigVariableDouble speedtree_max_anisotropy ("speedtree-max-anisotropy", 0.0, @@ -56,9 +56,9 @@ ConfigVariableDouble speedtree_max_anisotropy ConfigVariableBool speedtree_horizontal_billboards ("speedtree-horizontal-billboards", true, PRC_DESC("Set this true to allow the use of horizontal billboards in " - "SpeedTree, or false to disallow them. Horizontal billboards " - "may be defined for some trees to provide a billboard LOD " - "when the tree is seen from above.")); + "SpeedTree, or false to disallow them. Horizontal billboards " + "may be defined for some trees to provide a billboard LOD " + "when the tree is seen from above.")); ConfigVariableDouble speedtree_alpha_test_scalar ("speedtree-alpha-test-scalar", 0.57, @@ -67,15 +67,15 @@ ConfigVariableDouble speedtree_alpha_test_scalar ConfigVariableBool speedtree_z_pre_pass ("speedtree-z-pre-pass", false, PRC_DESC("True if the SpeedTree renderer should perform a first pass " - "to fill the depth buffer before going back to draw pixels. " - "This can result in a cost savings if there is much overdraw and " - "if the pixel shader is particularly expensive, but in most cases " - "it will result in a cost penalty.")); + "to fill the depth buffer before going back to draw pixels. " + "This can result in a cost savings if there is much overdraw and " + "if the pixel shader is particularly expensive, but in most cases " + "it will result in a cost penalty.")); ConfigVariableInt speedtree_max_billboard_images_by_base ("speedtree-max-billboard-images-by-base", 20, PRC_DESC("Specifies the maximum number of billboard images used by any single " - "tree.")); + "tree.")); ConfigVariableDouble speedtree_visibility ("speedtree-visibility", 1000.0, @@ -96,12 +96,12 @@ ConfigVariableBool speedtree_transmission_lighting ConfigVariableBool speedtree_detail_layer ("speedtree-detail-layer", false, PRC_DESC("True to render the detail texture layer defined on tree and " - "terrain objects, false otherwise.")); + "terrain objects, false otherwise.")); ConfigVariableBool speedtree_detail_normal_mapping ("speedtree-detail-normal-mapping", false, PRC_DESC("True to render the detail normal maps defined on tree and " - "terrain objects, false otherwise.")); + "terrain objects, false otherwise.")); ConfigVariableBool speedtree_ambient_contrast ("speedtree-ambient-contrast", false, @@ -114,7 +114,7 @@ ConfigVariableDouble speedtree_transmission_scalar ConfigVariableDouble speedtree_fog_distance ("speedtree-fog-distance", "2500 5000", PRC_DESC("Specifies the nearest and farthest distance of the fog on trees " - "and terrain.")); + "and terrain.")); ConfigVariableDouble speedtree_fog_color ("speedtree-fog-color", "1.0 1.0 1.0", @@ -123,7 +123,7 @@ ConfigVariableDouble speedtree_fog_color ConfigVariableDouble speedtree_sky_color ("speedtree-sky-color", "0.2 0.3 0.5", PRC_DESC("Specifies the r g b color of the SpeedTree sky, when the sky " - "is enabled. Currently unused.")); + "is enabled. Currently unused.")); ConfigVariableDouble speedtree_sky_fog ("speedtree-sky-fog", "-0.5 1.0", @@ -132,7 +132,7 @@ ConfigVariableDouble speedtree_sky_fog ConfigVariableDouble speedtree_sun_color ("speedtree-sun-color", "1.0 1.0 0.85", PRC_DESC("Specifies the r g b color of the SpeedTree sun, when the sun " - "is enabled. Currently unused.")); + "is enabled. Currently unused.")); ConfigVariableDouble speedtree_sun_size ("speedtree-sun-size", 0.001, @@ -149,24 +149,24 @@ ConfigVariableDouble speedtree_sun_fog_bloom ConfigVariableDouble speedtree_specular_color ("speedtree-specular-color", "1 1 1", PRC_DESC("Specifies the r g b color of the specular reflections on SpeedTree " - "surfaces.")); + "surfaces.")); ConfigVariableDouble speedtree_emissive_color ("speedtree-emissive-color", "0 0 0", PRC_DESC("Specifies the r g b color of the emissive light effect on SpeedTree " - "surfaces.")); + "surfaces.")); ConfigVariableInt speedtree_shadow_map_resolution ("speedtree-shadow-map-resolution", 0, //1024, PRC_DESC("Specifies the resolution for rendering shadow maps. Should " - "be a power of 2. Specify 0 to disable shadowing in SpeedTree.")); + "be a power of 2. Specify 0 to disable shadowing in SpeedTree.")); ConfigVariableDouble speedtree_cascading_shadow_splits ("speedtree-cascading-shadow-splits", "200 400 600", PRC_DESC("Specifies the shadow split distance, in spatial units, for " - "each shadow map to be rendered. The number of values also " - "implies the number of shadow maps, to a maximum value compiled " - "within SpeedTree (typically 4).")); + "each shadow map to be rendered. The number of values also " + "implies the number of shadow maps, to a maximum value compiled " + "within SpeedTree (typically 4).")); ConfigVariableBool speedtree_smooth_shadows ("speedtree-smooth-shadows", false, @@ -187,66 +187,66 @@ ConfigVariableBool speedtree_frond_rippling ConfigVariableInt speedtree_terrain_num_lods ("speedtree-terrain-num-lods", 5, PRC_DESC("Specifies the number of different LOD stages to use in " - "rendering terrain. Each stage has 75% few polygons than the " - "stage before. Increasing this number decreases the total " - "number of polygons onscreen, at the cost of visual quality of " - "distant terrain.")); + "rendering terrain. Each stage has 75% few polygons than the " + "stage before. Increasing this number decreases the total " + "number of polygons onscreen, at the cost of visual quality of " + "distant terrain.")); ConfigVariableInt speedtree_terrain_resolution ("speedtree-terrain-resolution", 33, PRC_DESC("Specifies the number of vertices per edge of each terrain grid " - "cell at the highest LOD. This must be a power of two plus 1.")); - + "cell at the highest LOD. This must be a power of two plus 1.")); + ConfigVariableInt speedtree_terrain_cell_size ("speedtree-terrain-cell-size", 800, PRC_DESC("Specifies the size in spatial units of one edge of a terrain " - "grid cell. This effects culling and resolution, but has nothing " - "to do with the scale of the heightmap or other maps.")); + "grid cell. This effects culling and resolution, but has nothing " + "to do with the scale of the heightmap or other maps.")); ConfigVariableDouble speedtree_shadow_fade ("speedtree-shadow-fade", 0.25, PRC_DESC("Specifies the rate at which shadows fade to transparency in the " - "distance.")); + "distance.")); ConfigVariableBool speedtree_show_overlays ("speedtree-show-overlays", false, PRC_DESC("True to draw onscreen overlays showing the generated " - "shadow map(s).")); + "shadow map(s).")); ConfigVariableInt speedtree_max_num_visible_cells ("speedtree-max-num-visible-cells", 75, PRC_DESC("Specifies the maximum number of cells in a single SpeedTree forest " - "frustum. This is used internally by SpeedTree's billboard system.")); + "frustum. This is used internally by SpeedTree's billboard system.")); ConfigVariableDouble speedtree_cull_cell_size ("speedtree-cull-cell-size", 1200, PRC_DESC("Specifies the size of a single SpeedTree cull cell, in Panda " - "units. Increasing this number decreases the number of " - "individual calls that must be made to render geometry, " - "while increasing the number of trees that are rendered " - "per call.")); + "units. Increasing this number decreases the number of " + "individual calls that must be made to render geometry, " + "while increasing the number of trees that are rendered " + "per call.")); ConfigVariableDouble speedtree_area_scale ("speedtree-area-scale", 3280.839895013, PRC_DESC("This is the factor by which the \"area\" value in a SpeedTree " - "terrain.txt file is scaled (after taking its square root) " - "when loading a new terrain. The default is about 3281, which " - "scales from kilometers to feet. You should set a different " - "scale if you use units other than feet.")); + "terrain.txt file is scaled (after taking its square root) " + "when loading a new terrain. The default is about 3281, which " + "scales from kilometers to feet. You should set a different " + "scale if you use units other than feet.")); ConfigVariableBool speedtree_follow_terrain ("speedtree-follow-terrain", true, PRC_DESC("Set this true to have trees automatically snap to the terrain " - "height when loaded into a SpeedTree node with a configured " - "terrain. If this is false, you may still call " - "SpeedTreeNode::snap_to_terrain() afterwards.")); + "height when loaded into a SpeedTree node with a configured " + "terrain. If this is false, you may still call " + "SpeedTreeNode::snap_to_terrain() afterwards.")); ConfigVariableInt speedtree_max_random_try_count ("speedtree-max-random-try-count", 1000, PRC_DESC("This is a cheesy limit to detect bad parameters passed to " - "SpeedTreeNode::add_random_instances(). If this number of attempts " - "to find a legal place for a tree fail in a row, the parameters " - "are deemed to be in error, and the function fails.")); + "SpeedTreeNode::add_random_instances(). If this number of attempts " + "to find a legal place for a tree fail in a row, the parameters " + "are deemed to be in error, and the function fails.")); ConfigVariableBool speedtree_5_2_stf ("speedtree-5-2-stf", @@ -256,8 +256,8 @@ ConfigVariableBool speedtree_5_2_stf false, #endif PRC_DESC("The format of the STF file changed in SpeedTree version 5.2. " - "Specify true here to read STF files in the new file format, or " - "false to read STF files in the pre-5.2 file format.")); + "Specify true here to read STF files in the new file format, or " + "false to read STF files in the pre-5.2 file format.")); //////////////////////////////////////////////////////////////////// diff --git a/panda/src/speedtree/speedTreeNode.h b/panda/src/speedtree/speedTreeNode.h index cd5000f587..12183b5e11 100644 --- a/panda/src/speedtree/speedTreeNode.h +++ b/panda/src/speedtree/speedTreeNode.h @@ -117,18 +117,18 @@ PUBLISHED: void add_instances_from(const SpeedTreeNode *other); void add_instances_from(const SpeedTreeNode *other, const TransformState *transform); void add_random_instances(const STTree *tree, int quantity, - float x_min, float x_max, - float y_min, float y_max, - float scale_min, float scale_max, - float height_min, float height_max, - float slope_min, float slope_max, - Randomizer &randomizer = Randomizer()); + float x_min, float x_max, + float y_min, float y_max, + float scale_min, float scale_max, + float height_min, float height_max, + float slope_min, float slope_max, + Randomizer &randomizer = Randomizer()); bool add_from_stf(const Filename &stf_filename, - const LoaderOptions &options = LoaderOptions()); + const LoaderOptions &options = LoaderOptions()); bool add_from_stf(istream &in, const Filename &pathname, - const LoaderOptions &options = LoaderOptions(), - Loader *loader = NULL); + const LoaderOptions &options = LoaderOptions(), + Loader *loader = NULL); bool setup_terrain(const Filename &terrain_file); void set_terrain(STTerrain *terrain); @@ -180,7 +180,7 @@ protected: private: void init_node(); void r_add_instances(PandaNode *node, const TransformState *transform, - Thread *current_thread); + Thread *current_thread); void repopulate(); void update_terrain_cells(); @@ -209,7 +209,7 @@ private: static void init_type() { CallbackObject::init_type(); register_type(_type_handle, "SpeedTreeNode::DrawCallback", - CallbackObject::get_class_type()); + CallbackObject::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/speedtree/stBasicTerrain.cxx b/panda/src/speedtree/stBasicTerrain.cxx index d5f45b8fb6..bf483e62f9 100644 --- a/panda/src/speedtree/stBasicTerrain.cxx +++ b/panda/src/speedtree/stBasicTerrain.cxx @@ -88,9 +88,9 @@ clear() { CPT(GeomVertexFormat) format = GeomVertexFormat::register_format (new GeomVertexArrayFormat(InternalName::get_vertex(), 3, - GeomEnums::NT_float32, GeomEnums::C_point, - InternalName::get_texcoord(), 3, - GeomEnums::NT_float32, GeomEnums::C_texcoord)); + GeomEnums::NT_float32, GeomEnums::C_point, + InternalName::get_texcoord(), 3, + GeomEnums::NT_float32, GeomEnums::C_texcoord)); set_vertex_format(format); } @@ -187,7 +187,7 @@ setup_terrain(istream &in, const Filename &pathname) { float r, g, b; in >> r >> g >> b; if (!_splat_layers.empty()) { - _splat_layers.back()._color.set(r, g, b, 1.0f); + _splat_layers.back()._color.set(r, g, b, 1.0f); } } else if (keyword == "ambient" || keyword == "diffuse" || keyword == "specular" || keyword == "emissive") { @@ -200,7 +200,7 @@ setup_terrain(istream &in, const Filename &pathname) { } else { speedtree_cat.error() - << "Invalid token " << keyword << " in " << pathname << "\n"; + << "Invalid token " << keyword << " in " << pathname << "\n"; return false; } @@ -319,8 +319,8 @@ get_slope(float x, float y) const { //////////////////////////////////////////////////////////////////// void STBasicTerrain:: fill_vertices(GeomVertexData *data, - float start_x, float start_y, - float size_xy, int num_xy) const { + float start_x, float start_y, + float size_xy, int num_xy) const { nassertv(data->get_format() == _vertex_format); GeomVertexWriter vertex(data, InternalName::get_vertex()); GeomVertexWriter texcoord(data, InternalName::get_texcoord()); @@ -435,7 +435,7 @@ compute_slope(float smoothing) { slope *= (0.5f / MathNumbers::pi_f); if (slope > 1.0f) { - slope = 1.0f; + slope = 1.0f; } _slope_data._data[i + j * width] = slope; } @@ -454,37 +454,37 @@ compute_slope(float smoothing) { // compute smoothed normals for (int i = 0; i < width; ++i) { - int left = (i + width - 1) % width; - int right = (i + 1) % width; + int left = (i + width - 1) % width; + int right = (i + 1) % width; - for (int j = 0; j < height; ++j) { - int top = (j + height - 1) % height; - int bottom = (j + 1) % height; + for (int j = 0; j < height; ++j) { + int top = (j + height - 1) % height; + int bottom = (j + 1) % height; - smoothed[i + j * width] = (_slope_data._data[right + j * width] + - _slope_data._data[left + j * width] + - _slope_data._data[i + top * width] + - _slope_data._data[i + bottom * width] + - _slope_data._data[right + top * width] + - _slope_data._data[right + bottom * width] + - _slope_data._data[left + top * width] + - _slope_data._data[left + bottom * width]); - smoothed[i + j * width] *= 0.125f; - } + smoothed[i + j * width] = (_slope_data._data[right + j * width] + + _slope_data._data[left + j * width] + + _slope_data._data[i + top * width] + + _slope_data._data[i + bottom * width] + + _slope_data._data[right + top * width] + + _slope_data._data[right + bottom * width] + + _slope_data._data[left + top * width] + + _slope_data._data[left + bottom * width]); + smoothed[i + j * width] *= 0.125f; + } } // interpolate or set if (si == steps - 1) { - // last step, interpolate - for (int i = 0; i < width; ++i) { - for (int j = 0; j < height; ++j) { - _slope_data._data[i + j * width] = interpolate(_slope_data._data[i + j * width], smoothed[i + j * width], last_interpolation); - } - } + // last step, interpolate + for (int i = 0; i < width; ++i) { + for (int j = 0; j < height; ++j) { + _slope_data._data[i + j * width] = interpolate(_slope_data._data[i + j * width], smoothed[i + j * width], last_interpolation); + } + } } else { - // full smoothing step, copy everything - _slope_data = smoothing_data; + // full smoothing step, copy everything + _slope_data = smoothing_data; } } } diff --git a/panda/src/speedtree/stBasicTerrain.h b/panda/src/speedtree/stBasicTerrain.h index 9fd55d945c..e07ac55e16 100644 --- a/panda/src/speedtree/stBasicTerrain.h +++ b/panda/src/speedtree/stBasicTerrain.h @@ -49,8 +49,8 @@ PUBLISHED: virtual float get_slope(float x, float y) const; virtual void fill_vertices(GeomVertexData *data, - float start_x, float start_y, - float size_xy, int num_xy) const; + float start_x, float start_y, + float size_xy, int num_xy) const; virtual void output(ostream &out) const; virtual void write(ostream &out, int indent_level = 0) const; @@ -63,7 +63,7 @@ protected: private: static void read_quoted_filename(Filename &result, istream &in, - const Filename &dirname); + const Filename &dirname); protected: template diff --git a/panda/src/speedtree/stTerrain.cxx b/panda/src/speedtree/stTerrain.cxx index e1c2c34ab1..2e6ce6777b 100644 --- a/panda/src/speedtree/stTerrain.cxx +++ b/panda/src/speedtree/stTerrain.cxx @@ -137,8 +137,8 @@ get_slope(float x, float y) const { //////////////////////////////////////////////////////////////////// bool STTerrain:: placement_is_acceptable(float x, float y, - float height_min, float height_max, - float slope_min, float slope_max) { + float height_min, float height_max, + float slope_min, float slope_max) { float height = get_height(x, y); if (height < height_min || height > height_max) { return false; @@ -171,8 +171,8 @@ placement_is_acceptable(float x, float y, //////////////////////////////////////////////////////////////////// void STTerrain:: fill_vertices(GeomVertexData *data, - float start_x, float start_y, - float size_xy, int num_xy) const { + float start_x, float start_y, + float size_xy, int num_xy) const { } //////////////////////////////////////////////////////////////////// @@ -247,7 +247,7 @@ set_vertex_format(const GeomVertexFormat *format) { //////////////////////////////////////////////////////////////////// bool STTerrain:: convert_vertex_format(STTerrain::VertexAttribs &st_vertex_attribs, - const GeomVertexFormat *format) { + const GeomVertexFormat *format) { st_vertex_attribs.clear(); if (format->get_num_arrays() != 1) { @@ -283,7 +283,7 @@ convert_vertex_format(STTerrain::VertexAttribs &st_vertex_attribs, //////////////////////////////////////////////////////////////////// bool STTerrain:: convert_vertex_column(SpeedTree::SVertexAttribDesc &st_attrib, - const GeomVertexColumn *column) { + const GeomVertexColumn *column) { switch (column->get_numeric_type()) { case GeomEnums::NT_float32: st_attrib.m_eDataType = SpeedTree::VERTEX_ATTRIB_TYPE_FLOAT; diff --git a/panda/src/speedtree/stTerrain.h b/panda/src/speedtree/stTerrain.h index 1048342758..d002451797 100644 --- a/panda/src/speedtree/stTerrain.h +++ b/panda/src/speedtree/stTerrain.h @@ -66,12 +66,12 @@ PUBLISHED: virtual float get_slope(float x, float y) const; bool placement_is_acceptable(float x, float y, - float height_min, float height_max, - float slope_min, float slope_max); + float height_min, float height_max, + float slope_min, float slope_max); virtual void fill_vertices(GeomVertexData *data, - float start_x, float start_y, - float size_xy, int num_xy) const; + float start_x, float start_y, + float size_xy, int num_xy) const; virtual void output(ostream &out) const; virtual void write(ostream &out, int indent_level = 0) const; @@ -84,9 +84,9 @@ protected: typedef pvector VertexAttribs; static bool convert_vertex_format(VertexAttribs &st_vertex_attribs, - const GeomVertexFormat *format); + const GeomVertexFormat *format); static bool convert_vertex_column(SpeedTree::SVertexAttribDesc &st_attrib, - const GeomVertexColumn *column); + const GeomVertexColumn *column); protected: class SplatLayer { diff --git a/panda/src/speedtree/stTransform.I b/panda/src/speedtree/stTransform.I index 5dea85de3c..c421982e65 100644 --- a/panda/src/speedtree/stTransform.I +++ b/panda/src/speedtree/stTransform.I @@ -115,8 +115,8 @@ operator SpeedTree::CInstance () const { INLINE STTransform:: operator CPT(TransformState) () const { return TransformState::make_pos_hpr_scale(_pos, - LVecBase3f(_rotate, 0.0f, 0.0f), - LVecBase3f(_scale, _scale, _scale)); + LVecBase3f(_rotate, 0.0f, 0.0f), + LVecBase3f(_scale, _scale, _scale)); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/tform/config_tform.cxx b/panda/src/tform/config_tform.cxx index 289f152291..fbe2e3b988 100644 --- a/panda/src/tform/config_tform.cxx +++ b/panda/src/tform/config_tform.cxx @@ -57,9 +57,9 @@ ConfigVariableDouble inactivity_timeout ConfigVariableBool trackball_use_alt_keys ("trackball-use-alt-keys", true, PRC_DESC("Set this true to use the command and option/control keys in " - "conjunction with the first mouse button to simulate the behavior of " - "the second and third mouse buttons in trackball mode. Particularly " - "useful for Macs, or laptops with limited mouse buttons.")); + "conjunction with the first mouse button to simulate the behavior of " + "the second and third mouse buttons in trackball mode. Particularly " + "useful for Macs, or laptops with limited mouse buttons.")); ConfigureFn(config_tform) { DriveInterface::init_type(); diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index 910da619ac..8c83936c98 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -2100,12 +2100,12 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { #ifdef PANDA_WIN7 case WM_TOUCH: - _numTouches = LOWORD(wparam); - if(_numTouches > MAX_TOUCHES) - _numTouches = MAX_TOUCHES; - GetTouchInputInfo((HTOUCHINPUT)lparam, _numTouches, _touches, sizeof(TOUCHINPUT)); - CloseTouchInputHandle((HTOUCHINPUT)lparam); - break; + _numTouches = LOWORD(wparam); + if(_numTouches > MAX_TOUCHES) + _numTouches = MAX_TOUCHES; + GetTouchInputInfo((HTOUCHINPUT)lparam, _numTouches, _touches, sizeof(TOUCHINPUT)); + CloseTouchInputHandle((HTOUCHINPUT)lparam); + break; #endif } diff --git a/panda/src/windisplay/winGraphicsWindow.h b/panda/src/windisplay/winGraphicsWindow.h index f7029f7c1a..96b336f856 100644 --- a/panda/src/windisplay/winGraphicsWindow.h +++ b/panda/src/windisplay/winGraphicsWindow.h @@ -18,7 +18,7 @@ #include "pandabase.h" #include "graphicsWindow.h" #ifndef WIN32_LEAN_AND_MEAN - #define WIN32_LEAN_AND_MEAN 1 + #define WIN32_LEAN_AND_MEAN 1 #endif #include