Changeset 1154 for trunk/libffado
- Timestamp:
- 05/10/08 08:39:39 (16 years ago)
- Files:
-
- trunk/libffado/config.h.in (modified) (1 diff)
- trunk/libffado/SConstruct (modified) (4 diffs)
- trunk/libffado/src/bebob/bebob_avdevice.cpp (modified) (5 diffs)
- trunk/libffado/src/bebob/bebob_avdevice.h (modified) (2 diffs)
- trunk/libffado/src/bebob/bebob_avdevice_subunit.cpp (modified) (6 diffs)
- trunk/libffado/src/bebob/bebob_avdevice_subunit.h (modified) (2 diffs)
- trunk/libffado/src/bebob/bebob_avplug.h (modified) (1 diff)
- trunk/libffado/src/bebob/bebob_functionblock.cpp (modified) (13 diffs)
- trunk/libffado/src/bebob/bebob_functionblock.h (modified) (7 diffs)
- trunk/libffado/src/devicemanager.h (modified) (1 diff)
- trunk/libffado/src/genericavc/avc_avdevice.cpp (modified) (2 diffs)
- trunk/libffado/src/genericavc/avc_avdevice.h (modified) (1 diff)
- trunk/libffado/src/libavc/audiosubunit/avc_audiosubunit.h (modified) (1 diff)
- trunk/libffado/src/libavc/general/avc_plug.cpp (modified) (16 diffs)
- trunk/libffado/src/libavc/general/avc_plug.h (modified) (10 diffs)
- trunk/libffado/src/libavc/general/avc_subunit.cpp (modified) (3 diffs)
- trunk/libffado/src/libavc/general/avc_subunit.h (modified) (2 diffs)
- trunk/libffado/src/libavc/general/avc_unit.cpp (modified) (8 diffs)
- trunk/libffado/src/libavc/general/avc_unit.h (modified) (2 diffs)
- trunk/libffado/src/libavc/musicsubunit/avc_musicsubunit.cpp (modified) (3 diffs)
- trunk/libffado/src/libavc/musicsubunit/avc_musicsubunit.h (modified) (1 diff)
- trunk/libffado/src/libieee1394/configrom.cpp (modified) (6 diffs)
- trunk/libffado/src/libieee1394/configrom.h (modified) (3 diffs)
- trunk/libffado/src/libutil/OptionContainer.cpp (modified) (4 diffs)
- trunk/libffado/src/libutil/OptionContainer.h (modified) (2 diffs)
- trunk/libffado/src/libutil/serialize.h (added)
- trunk/libffado/src/libutil/serialize_expat.cpp (copied) (copied from trunk/libffado/src/libutil/serialize.cpp) (16 diffs)
- trunk/libffado/src/libutil/serialize_expat.h (copied) (copied from trunk/libffado/src/libutil/serialize.h) (8 diffs)
- trunk/libffado/src/libutil/serialize_libxml.cpp (moved) (moved from trunk/libffado/src/libutil/serialize.cpp) (7 diffs)
- trunk/libffado/src/libutil/serialize_libxml.h (copied) (copied from trunk/libffado/src/libutil/serialize.h) (9 diffs)
- trunk/libffado/src/libutil/unittests.cpp (modified) (2 diffs)
- trunk/libffado/src/maudio/maudio_avdevice.cpp (modified) (1 diff)
- trunk/libffado/src/SConscript (modified) (3 diffs)
- trunk/libffado/support/dbus/SConscript (modified) (1 diff)
- trunk/libffado/support/firmware/SConscript (modified) (1 diff)
- trunk/libffado/tests/SConscript (modified) (1 diff)
- trunk/libffado/tests/systemtests/SConscript (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/config.h.in
r1116 r1154 37 37 /* Define indicatin availability of lrintf() */ 38 38 #define HAVE_LRINTF $HAVE_LRINTF 39 40 // serialization 41 #define SERIALIZE_USE_EXPAT $SERIALIZE_USE_EXPAT 39 42 40 43 // use a RT-safe message buffer for debug output trunk/libffado/SConstruct
r1153 r1154 74 74 this code.""", False ), 75 75 BoolOption( "ENABLE_ALL", "Enable/Disable support for all devices.", False ), 76 BoolOption( "SERIALIZE_USE_EXPAT", "Use libexpat for XML serialization.", False ), 76 77 BoolOption( "BUILD_TESTS", """\ 77 78 Build the tests in their directory. As some contain quite some functionality, … … 162 163 log_file = "cache/" + build_base + 'config.log' ) 163 164 165 if env['SERIALIZE_USE_EXPAT']: 166 env['SERIALIZE_USE_EXPAT']=1 167 else: 168 env['SERIALIZE_USE_EXPAT']=0 169 164 170 if not env.GetOption('clean'): 165 171 # … … 182 188 # 183 189 allpresent = 1; 190 # for DBUS C++ bindings 184 191 allpresent &= conf.CheckHeader( "expat.h" ) 185 192 allpresent &= conf.CheckLib( 'expat', 'XML_ExpatVersion', '#include <expat.h>' ) … … 191 198 'libavc1394' : '0.5.3', 192 199 'libiec61883' : '1.1.0', 193 'libxml++-2.6' : '2.13.0',194 200 'dbus-1' : '1.0', 195 201 } 202 if not env['SERIALIZE_USE_EXPAT']: 203 pkgs['libxml++-2.6'] = '2.13.0' 204 196 205 for pkg in pkgs: 197 206 name2 = pkg.replace("+","").replace(".","").replace("-","").upper() trunk/libffado/src/bebob/bebob_avdevice.cpp
r1066 r1154 380 380 381 381 bool 382 AvDevice::serialize( Glib::ustring basePath,382 AvDevice::serialize( std::string basePath, 383 383 Util::IOSerialize& ser ) const 384 384 { … … 389 389 390 390 bool 391 AvDevice::deserialize( Glib::ustring basePath,391 AvDevice::deserialize( std::string basePath, 392 392 Util::IODeserialize& deser ) 393 393 { … … 397 397 } 398 398 399 Glib::ustring399 std::string 400 400 AvDevice::getCachePath() 401 401 { 402 Glib::ustring cachePath;402 std::string cachePath; 403 403 char* pCachePath; 404 404 … … 422 422 AvDevice::loadFromCache() 423 423 { 424 Glib::ustring sDevicePath = getCachePath() + getConfigRom().getGuidString();424 std::string sDevicePath = getCachePath() + getConfigRom().getGuidString(); 425 425 426 426 char* configId; … … 431 431 } 432 432 433 Glib::ustring sFileName = sDevicePath + "/" + configId + ".xml";433 std::string sFileName = sDevicePath + "/" + configId + ".xml"; 434 434 free( configId ); 435 435 debugOutput( DEBUG_LEVEL_NORMAL, "filename %s\n", sFileName.c_str() ); trunk/libffado/src/bebob/bebob_avdevice.h
r864 r1154 90 90 91 91 public: 92 virtual bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const;93 virtual bool deserialize( Glib::ustring basePath, Util::IODeserialize& deser );92 virtual bool serialize( std::string basePath, Util::IOSerialize& ser ) const; 93 virtual bool deserialize( std::string basePath, Util::IODeserialize& deser ); 94 94 95 95 int getConfigurationIdSampleRate(); … … 98 98 int getConfigurationId(); 99 99 100 Glib::ustring getCachePath();100 std::string getCachePath(); 101 101 102 102 protected: trunk/libffado/src/bebob/bebob_avdevice_subunit.cpp
r1110 r1154 339 339 340 340 bool 341 BeBoB::SubunitAudio::serializeChild( Glib::ustring basePath,341 BeBoB::SubunitAudio::serializeChild( std::string basePath, 342 342 Util::IOSerialize& ser ) const 343 343 { … … 362 362 363 363 bool 364 BeBoB::SubunitAudio::deserializeChild( Glib::ustring basePath,364 BeBoB::SubunitAudio::deserializeChild( std::string basePath, 365 365 Util::IODeserialize& deser, 366 366 AVC::Unit& avDevice ) … … 387 387 388 388 bool 389 BeBoB::SubunitAudio::deserializeUpdateChild( Glib::ustring basePath,389 BeBoB::SubunitAudio::deserializeUpdateChild( std::string basePath, 390 390 Util::IODeserialize& deser ) 391 391 { … … 467 467 468 468 bool 469 BeBoB::SubunitMusic::serializeChild( Glib::ustring basePath,469 BeBoB::SubunitMusic::serializeChild( std::string basePath, 470 470 Util::IOSerialize& ser ) const 471 471 { … … 474 474 475 475 bool 476 BeBoB::SubunitMusic::deserializeChild( Glib::ustring basePath,476 BeBoB::SubunitMusic::deserializeChild( std::string basePath, 477 477 Util::IODeserialize& deser, 478 478 AVC::Unit& avDevice ) … … 482 482 483 483 bool 484 BeBoB::SubunitMusic::deserializeUpdateChild( Glib::ustring basePath,484 BeBoB::SubunitMusic::deserializeUpdateChild( std::string basePath, 485 485 Util::IODeserialize& deser ) 486 486 { trunk/libffado/src/bebob/bebob_avdevice_subunit.h
r1110 r1154 77 77 AVC::function_block_special_purpose_t specialPurpose ); 78 78 79 virtual bool serializeChild( Glib::ustring basePath,79 virtual bool serializeChild( std::string basePath, 80 80 Util::IOSerialize& ser ) const; 81 virtual bool deserializeChild( Glib::ustring basePath,81 virtual bool deserializeChild( std::string basePath, 82 82 Util::IODeserialize& deser, 83 83 AVC::Unit& unit ); 84 virtual bool deserializeUpdateChild( Glib::ustring basePath,84 virtual bool deserializeUpdateChild( std::string basePath, 85 85 Util::IODeserialize& deser ); 86 86 … … 112 112 113 113 protected: 114 virtual bool serializeChild( Glib::ustring basePath,114 virtual bool serializeChild( std::string basePath, 115 115 Util::IOSerialize& ser ) const; 116 virtual bool deserializeChild( Glib::ustring basePath,116 virtual bool deserializeChild( std::string basePath, 117 117 Util::IODeserialize& deser, 118 118 AVC::Unit& unit ); 119 virtual bool deserializeUpdateChild( Glib::ustring basePath,119 virtual bool deserializeUpdateChild( std::string basePath, 120 120 Util::IODeserialize& deser ); 121 121 trunk/libffado/src/bebob/bebob_avplug.h
r864 r1154 36 36 37 37 #include "debugmodule/debugmodule.h" 38 39 #include <glibmm/ustring.h>40 38 41 39 class Ieee1394Service; trunk/libffado/src/bebob/bebob_functionblock.cpp
r1110 r1154 162 162 163 163 bool 164 FunctionBlock::serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const164 FunctionBlock::serialize( std::string basePath, Util::IOSerialize& ser ) const 165 165 { 166 166 bool result; … … 178 178 179 179 FunctionBlock* 180 FunctionBlock::deserialize( Glib::ustring basePath,180 FunctionBlock::deserialize( std::string basePath, 181 181 Util::IODeserialize& deser, 182 182 AVC::Unit& unit, … … 241 241 242 242 bool 243 FunctionBlock::deserializeUpdate( Glib::ustring basePath,243 FunctionBlock::deserializeUpdate( std::string basePath, 244 244 Util::IODeserialize& deser ) 245 245 { … … 293 293 294 294 bool 295 FunctionBlockSelector::serializeChild( Glib::ustring basePath,295 FunctionBlockSelector::serializeChild( std::string basePath, 296 296 Util::IOSerialize& ser ) const 297 297 { … … 300 300 301 301 bool 302 FunctionBlockSelector::deserializeChild( Glib::ustring basePath,302 FunctionBlockSelector::deserializeChild( std::string basePath, 303 303 Util::IODeserialize& deser, 304 304 AvDevice& unit ) … … 349 349 350 350 bool 351 FunctionBlockFeature::serializeChild( Glib::ustring basePath,351 FunctionBlockFeature::serializeChild( std::string basePath, 352 352 Util::IOSerialize& ser ) const 353 353 { … … 356 356 357 357 bool 358 FunctionBlockFeature::deserializeChild( Glib::ustring basePath,358 FunctionBlockFeature::deserializeChild( std::string basePath, 359 359 Util::IODeserialize& deser, 360 360 AvDevice& unit ) … … 452 452 453 453 bool 454 FunctionBlockEnhancedMixer::serializeChild( Glib::ustring basePath,454 FunctionBlockEnhancedMixer::serializeChild( std::string basePath, 455 455 Util::IOSerialize& ser ) const 456 456 { … … 459 459 460 460 bool 461 FunctionBlockEnhancedMixer::deserializeChild( Glib::ustring basePath,461 FunctionBlockEnhancedMixer::deserializeChild( std::string basePath, 462 462 Util::IODeserialize& deser, 463 463 AvDevice& unit ) … … 508 508 509 509 bool 510 FunctionBlockProcessing::serializeChild( Glib::ustring basePath,510 FunctionBlockProcessing::serializeChild( std::string basePath, 511 511 Util::IOSerialize& ser ) const 512 512 { … … 515 515 516 516 bool 517 FunctionBlockProcessing::deserializeChild( Glib::ustring basePath,517 FunctionBlockProcessing::deserializeChild( std::string basePath, 518 518 Util::IODeserialize& deser, 519 519 AvDevice& unit ) … … 563 563 564 564 bool 565 FunctionBlockCodec::serializeChild( Glib::ustring basePath,565 FunctionBlockCodec::serializeChild( std::string basePath, 566 566 Util::IOSerialize& ser ) const 567 567 { … … 570 570 571 571 bool 572 FunctionBlockCodec::deserializeChild( Glib::ustring basePath,572 FunctionBlockCodec::deserializeChild( std::string basePath, 573 573 Util::IODeserialize& deser, 574 574 AvDevice& unit ) trunk/libffado/src/bebob/bebob_functionblock.h
r1110 r1154 30 30 31 31 #include "debugmodule/debugmodule.h" 32 33 #include <string> 32 34 33 35 namespace AVC { … … 77 79 AVC::no_of_output_plugs_t getNrOfOutputPlugs() {return m_nrOfOutputPlugs;}; 78 80 79 bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const;80 81 static FunctionBlock* deserialize( Glib::ustring basePath,81 bool serialize( std::string basePath, Util::IOSerialize& ser ) const; 82 83 static FunctionBlock* deserialize( std::string basePath, 82 84 Util::IODeserialize& deser, 83 85 AVC::Unit& unit, 84 86 AVC::Subunit& subunit ); 85 bool deserializeUpdate( Glib::ustring basePath,87 bool deserializeUpdate( std::string basePath, 86 88 Util::IODeserialize& deser ); 87 89 protected: … … 124 126 125 127 protected: 126 virtual bool serializeChild( Glib::ustring basePath,127 Util::IOSerialize& ser ) const; 128 virtual bool deserializeChild( Glib::ustring basePath,128 virtual bool serializeChild( std::string basePath, 129 Util::IOSerialize& ser ) const; 130 virtual bool deserializeChild( std::string basePath, 129 131 Util::IODeserialize& deser, 130 132 AvDevice& avDevice ); … … 166 168 167 169 protected: 168 virtual bool serializeChild( Glib::ustring basePath,169 Util::IOSerialize& ser ) const; 170 virtual bool deserializeChild( Glib::ustring basePath,170 virtual bool serializeChild( std::string basePath, 171 Util::IOSerialize& ser ) const; 172 virtual bool deserializeChild( std::string basePath, 171 173 Util::IODeserialize& deser, 172 174 AvDevice& avDevice ); … … 193 195 194 196 protected: 195 virtual bool serializeChild( Glib::ustring basePath,196 Util::IOSerialize& ser ) const; 197 virtual bool deserializeChild( Glib::ustring basePath,197 virtual bool serializeChild( std::string basePath, 198 Util::IOSerialize& ser ) const; 199 virtual bool deserializeChild( std::string basePath, 198 200 Util::IODeserialize& deser, 199 201 AvDevice& avDevice ); … … 218 220 219 221 protected: 220 virtual bool serializeChild( Glib::ustring basePath,221 Util::IOSerialize& ser ) const; 222 virtual bool deserializeChild( Glib::ustring basePath,222 virtual bool serializeChild( std::string basePath, 223 Util::IOSerialize& ser ) const; 224 virtual bool deserializeChild( std::string basePath, 223 225 Util::IODeserialize& deser, 224 226 AvDevice& avDevice ); … … 243 245 244 246 protected: 245 virtual bool serializeChild( Glib::ustring basePath,246 Util::IOSerialize& ser ) const; 247 virtual bool deserializeChild( Glib::ustring basePath,247 virtual bool serializeChild( std::string basePath, 248 Util::IOSerialize& ser ) const; 249 virtual bool deserializeChild( std::string basePath, 248 250 Util::IODeserialize& deser, 249 251 AvDevice& avDevice ); trunk/libffado/src/devicemanager.h
r967 r1154 35 35 #include "libutil/OptionContainer.h" 36 36 #include "libcontrol/BasicElements.h" 37 38 #include <glibmm/ustring.h>39 37 40 38 #include "libutil/Functors.h" trunk/libffado/src/genericavc/avc_avdevice.cpp
r1135 r1154 754 754 755 755 bool 756 AvDevice::serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const756 AvDevice::serialize( std::string basePath, Util::IOSerialize& ser ) const 757 757 { 758 758 bool result; … … 763 763 764 764 bool 765 AvDevice::deserialize( Glib::ustring basePath, Util::IODeserialize& deser )765 AvDevice::deserialize( std::string basePath, Util::IODeserialize& deser ) 766 766 { 767 767 bool result; trunk/libffado/src/genericavc/avc_avdevice.h
r864 r1154 55 55 static FFADODevice * createDevice( DeviceManager& d, std::auto_ptr<ConfigRom>( configRom )); 56 56 57 virtual bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const;58 virtual bool deserialize( Glib::ustring basePath, Util::IODeserialize& deser );57 virtual bool serialize( std::string basePath, Util::IOSerialize& ser ) const; 58 virtual bool deserialize( std::string basePath, Util::IODeserialize& deser ); 59 59 60 60 virtual void setVerboseLevel(int l); trunk/libffado/src/libavc/audiosubunit/avc_audiosubunit.h
r1110 r1154 51 51 52 52 protected: 53 virtual bool serializeChild( Glib::ustring basePath,53 virtual bool serializeChild( std::string basePath, 54 54 Util::IOSerialize& ser ) const { return true; } 55 virtual bool deserializeChild( Glib::ustring basePath,55 virtual bool deserializeChild( std::string basePath, 56 56 Util::IODeserialize& deser, 57 57 Unit& avDevice ) { return true; } 58 virtual bool deserializeUpdateChild( Glib::ustring basePath,58 virtual bool deserializeUpdateChild( std::string basePath, 59 59 Util::IODeserialize& deser ) { return true; } 60 60 trunk/libffado/src/libavc/general/avc_plug.cpp
r1110 r1154 1428 1428 1429 1429 bool 1430 Plug::serializeChannelInfos( Glib::ustring basePath,1430 Plug::serializeChannelInfos( std::string basePath, 1431 1431 Util::IOSerialize& ser, 1432 1432 const ClusterInfo& clusterInfo ) const … … 1452 1452 1453 1453 bool 1454 Plug::deserializeChannelInfos( Glib::ustring basePath,1454 Plug::deserializeChannelInfos( std::string basePath, 1455 1455 Util::IODeserialize& deser, 1456 1456 ClusterInfo& clusterInfo ) … … 1488 1488 1489 1489 bool 1490 Plug::serializeClusterInfos( Glib::ustring basePath,1490 Plug::serializeClusterInfos( std::string basePath, 1491 1491 Util::IOSerialize& ser ) const 1492 1492 { … … 1514 1514 1515 1515 bool 1516 Plug::deserializeClusterInfos( Glib::ustring basePath,1516 Plug::deserializeClusterInfos( std::string basePath, 1517 1517 Util::IODeserialize& deser ) 1518 1518 { … … 1552 1552 1553 1553 bool 1554 Plug::serializeFormatInfos( Glib::ustring basePath,1554 Plug::serializeFormatInfos( std::string basePath, 1555 1555 Util::IOSerialize& ser ) const 1556 1556 { … … 1576 1576 1577 1577 bool 1578 Plug::deserializeFormatInfos( Glib::ustring basePath,1578 Plug::deserializeFormatInfos( std::string basePath, 1579 1579 Util::IODeserialize& deser ) 1580 1580 { … … 1612 1612 1613 1613 bool 1614 Plug::serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const1614 Plug::serialize( std::string basePath, Util::IOSerialize& ser ) const 1615 1615 { 1616 1616 bool result=true; … … 1637 1637 1638 1638 Plug* 1639 Plug::deserialize( Glib::ustring basePath,1639 Plug::deserialize( std::string basePath, 1640 1640 Util::IODeserialize& deser, 1641 1641 Unit& unit, … … 1692 1692 1693 1693 bool 1694 Plug::deserializeConnections( Glib::ustring basePath,1694 Plug::deserializeConnections( std::string basePath, 1695 1695 Util::IODeserialize& deser ) 1696 1696 { … … 2151 2151 2152 2152 bool 2153 PlugManager::serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const2153 PlugManager::serialize( std::string basePath, Util::IOSerialize& ser ) const 2154 2154 { 2155 2155 bool result = true; … … 2170 2170 2171 2171 PlugManager* 2172 PlugManager::deserialize( Glib::ustring basePath,2172 PlugManager::deserialize( std::string basePath, 2173 2173 Util::IODeserialize& deser, 2174 2174 Unit& unit ) … … 2202 2202 2203 2203 bool 2204 PlugManager::deserializeUpdate( Glib::ustring basePath,2204 PlugManager::deserializeUpdate( std::string basePath, 2205 2205 Util::IODeserialize& deser) 2206 2206 { … … 2239 2239 2240 2240 bool 2241 PlugConnection::serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const2241 PlugConnection::serialize( std::string basePath, Util::IOSerialize& ser ) const 2242 2242 { 2243 2243 bool result; … … 2248 2248 2249 2249 PlugConnection* 2250 PlugConnection::deserialize( Glib::ustring basePath,2250 PlugConnection::deserialize( std::string basePath, 2251 2251 Util::IODeserialize& deser, 2252 2252 Unit& unit ) … … 2358 2358 2359 2359 bool 2360 serializePlugVector( Glib::ustring basePath,2360 serializePlugVector( std::string basePath, 2361 2361 Util::IOSerialize& ser, 2362 2362 const PlugVector& vec) … … 2379 2379 2380 2380 bool 2381 deserializePlugVector( Glib::ustring basePath,2381 deserializePlugVector( std::string basePath, 2382 2382 Util::IODeserialize& deser, 2383 2383 const PlugManager& plugManager, trunk/libffado/src/libavc/general/avc_plug.h
r864 r1154 35 35 #include "debugmodule/debugmodule.h" 36 36 37 #include < glibmm/ustring.h>37 #include <string> 38 38 39 39 class Ieee1394Service; … … 155 155 void showPlug() const; 156 156 157 bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const;158 static Plug* deserialize( Glib::ustring basePath,157 bool serialize( std::string basePath, Util::IOSerialize& ser ) const; 158 static Plug* deserialize( std::string basePath, 159 159 Util::IODeserialize& deser, 160 160 Unit& avDevice, 161 161 PlugManager& plugManager ); 162 bool deserializeConnections( Glib::ustring basePath,162 bool deserializeConnections( std::string basePath, 163 163 Util::IODeserialize& deser ); 164 164 bool deserializeUpdateSubunit(); … … 168 168 stream_position_t m_streamPosition; 169 169 stream_position_location_t m_location; 170 Glib::ustring m_name;170 std::string m_name; 171 171 }; 172 172 typedef std::vector<ChannelInfo> ChannelInfoVector; … … 175 175 int m_index; 176 176 port_type_t m_portType; 177 Glib::ustringm_name;177 std::string m_name; 178 178 179 179 nr_of_channels_t m_nrOfChannels; … … 240 240 const ClusterInfo* getClusterInfoByIndex( int index ) const; 241 241 242 bool serializeChannelInfos( Glib::ustring basePath,242 bool serializeChannelInfos( std::string basePath, 243 243 Util::IOSerialize& ser, 244 244 const ClusterInfo& clusterInfo ) const; 245 bool deserializeChannelInfos( Glib::ustring basePath,245 bool deserializeChannelInfos( std::string basePath, 246 246 Util::IODeserialize& deser, 247 247 ClusterInfo& clusterInfo ); 248 248 249 bool serializeClusterInfos( Glib::ustring basePath,249 bool serializeClusterInfos( std::string basePath, 250 250 Util::IOSerialize& ser ) const; 251 bool deserializeClusterInfos( Glib::ustring basePath,251 bool deserializeClusterInfos( std::string basePath, 252 252 Util::IODeserialize& deser ); 253 253 254 bool serializeFormatInfos( Glib::ustring basePath,254 bool serializeFormatInfos( std::string basePath, 255 255 Util::IOSerialize& ser ) const; 256 bool deserializeFormatInfos( Glib::ustring basePath,256 bool deserializeFormatInfos( std::string basePath, 257 257 Util::IODeserialize& deser ); 258 258 … … 287 287 EPlugType m_infoPlugType; 288 288 nr_of_channels_t m_nrOfChannels; 289 Glib::ustringm_name;289 std::string m_name; 290 290 ClusterInfoVector m_clusterInfos; 291 291 sampling_frequency_t m_samplingFrequency; … … 334 334 Plug::EPlugType type) const; 335 335 336 bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const;337 static PlugManager* deserialize( Glib::ustring basePath,336 bool serialize( std::string basePath, Util::IOSerialize& ser ) const; 337 static PlugManager* deserialize( std::string basePath, 338 338 Util::IODeserialize& deser, 339 339 Unit& avDevice ); … … 343 343 bool tidyPlugConnections(PlugConnectionVector&); 344 344 345 bool deserializeUpdate( Glib::ustring basePath,345 bool deserializeUpdate( std::string basePath, 346 346 Util::IODeserialize& deser ); 347 347 … … 362 362 { return *m_destPlug; } 363 363 364 bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const;365 static PlugConnection* deserialize( Glib::ustring basePath,364 bool serialize( std::string basePath, Util::IOSerialize& ser ) const; 365 static PlugConnection* deserialize( std::string basePath, 366 366 Util::IODeserialize& deser, 367 367 Unit& avDevice ); … … 377 377 378 378 379 bool serializePlugVector( Glib::ustring basePath,379 bool serializePlugVector( std::string basePath, 380 380 Util::IOSerialize& ser, 381 381 const PlugVector& vec); 382 382 383 bool deserializePlugVector( Glib::ustring basePath,383 bool deserializePlugVector( std::string basePath, 384 384 Util::IODeserialize& deser, 385 385 const PlugManager& plugManager, trunk/libffado/src/libavc/general/avc_subunit.cpp
r1110 r1154 231 231 232 232 bool 233 Subunit::serialize( Glib::ustring basePath,233 Subunit::serialize( std::string basePath, 234 234 Util::IOSerialize& ser ) const 235 235 { … … 245 245 246 246 Subunit* 247 Subunit::deserialize( Glib::ustring basePath,247 Subunit::deserialize( std::string basePath, 248 248 Util::IODeserialize& deser, 249 249 Unit& unit ) … … 278 278 279 279 bool 280 Subunit::deserializeUpdate( Glib::ustring basePath,280 Subunit::deserializeUpdate( std::string basePath, 281 281 Util::IODeserialize& deser ) 282 282 { trunk/libffado/src/libavc/general/avc_subunit.h
r1110 r1154 78 78 virtual void setVerboseLevel(int l); 79 79 80 bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const;81 static Subunit* deserialize( Glib::ustring basePath,80 bool serialize( std::string basePath, Util::IOSerialize& ser ) const; 81 static Subunit* deserialize( std::string basePath, 82 82 Util::IODeserialize& deser, Unit& avDevice ); 83 bool deserializeUpdate( Glib::ustring basePath,83 bool deserializeUpdate( std::string basePath, 84 84 Util::IODeserialize& deser ); 85 85 … … 87 87 Subunit(); 88 88 89 virtual bool serializeChild( Glib::ustring basePath,89 virtual bool serializeChild( std::string basePath, 90 90 Util::IOSerialize& ser ) const = 0; 91 virtual bool deserializeChild( Glib::ustring basePath,91 virtual bool deserializeChild( std::string basePath, 92 92 Util::IODeserialize& deser, 93 93 Unit& avDevice ) = 0; 94 virtual bool deserializeUpdateChild( Glib::ustring basePath,94 virtual bool deserializeUpdateChild( std::string basePath, 95 95 Util::IODeserialize& deser ) = 0; 96 96 trunk/libffado/src/libavc/general/avc_unit.cpp
r1110 r1154 845 845 template <typename T> 846 846 bool 847 serializeVector( Glib::ustring path,847 serializeVector( std::string path, 848 848 Util::IOSerialize& ser, 849 849 const T& vec ) … … 862 862 template <typename T, typename VT> 863 863 bool 864 deserializeVector( Glib::ustring path,864 deserializeVector( std::string path, 865 865 Util::IODeserialize& deser, 866 866 Unit& unit, … … 885 885 886 886 bool 887 Unit::serializeSyncInfoVector( Glib::ustring basePath,887 Unit::serializeSyncInfoVector( std::string basePath, 888 888 Util::IOSerialize& ser, 889 889 const SyncInfoVector& vec ) const … … 903 903 result &= ser.write( strstrm.str() + "m_source", info.m_source->getGlobalId() ); 904 904 result &= ser.write( strstrm.str() + "m_destination", info.m_destination->getGlobalId() ); 905 result &= ser.write( strstrm.str() + "m_description", Glib::ustring( info.m_description ) );905 result &= ser.write( strstrm.str() + "m_description", std::string( info.m_description ) ); 906 906 907 907 i++; … … 912 912 913 913 bool 914 Unit::deserializeSyncInfoVector( Glib::ustring basePath,914 Unit::deserializeSyncInfoVector( std::string basePath, 915 915 Util::IODeserialize& deser, 916 916 SyncInfoVector& vec ) … … 925 925 plug_id_t sourceId; 926 926 plug_id_t destinationId; 927 Glib::ustring description;927 std::string description; 928 928 929 929 if ( deser.isExisting( strstrm.str() + "m_source" ) ) { … … 952 952 953 953 bool 954 Unit::serialize( Glib::ustring basePath,954 Unit::serialize( std::string basePath, 955 955 Util::IOSerialize& ser ) const 956 956 { … … 980 980 981 981 bool 982 Unit::deserialize( Glib::ustring basePath,982 Unit::deserialize( std::string basePath, 983 983 Util::IODeserialize& deser ) 984 984 { trunk/libffado/src/libavc/general/avc_unit.h
r864 r1154 93 93 virtual bool setActiveSync( const SyncInfo& syncInfo ); 94 94 95 virtual bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const;96 virtual bool deserialize( Glib::ustring basePath, Util::IODeserialize& deser );95 virtual bool serialize( std::string basePath, Util::IOSerialize& ser ) const; 96 virtual bool deserialize( std::string basePath, Util::IODeserialize& deser ); 97 97 98 98 SubunitAudio* getAudioSubunit( subunit_id_t subunitId ) … … 152 152 153 153 154 bool serializeSyncInfoVector( Glib::ustring basePath,154 bool serializeSyncInfoVector( std::string basePath, 155 155 Util::IOSerialize& ser, 156 156 const SyncInfoVector& vec ) const; 157 bool deserializeSyncInfoVector( Glib::ustring basePath,157 bool deserializeSyncInfoVector( std::string basePath, 158 158 Util::IODeserialize& deser, 159 159 SyncInfoVector& vec ); trunk/libffado/src/libavc/musicsubunit/avc_musicsubunit.cpp
r1110 r1154 304 304 305 305 bool 306 SubunitMusic::serializeChild( Glib::ustring basePath,306 SubunitMusic::serializeChild( std::string basePath, 307 307 Util::IOSerialize& ser ) const 308 308 { … … 311 311 312 312 bool 313 SubunitMusic::deserializeChild( Glib::ustring basePath,313 SubunitMusic::deserializeChild( std::string basePath, 314 314 Util::IODeserialize& deser, 315 315 Unit& unit ) … … 319 319 320 320 bool 321 SubunitMusic::deserializeUpdateChild( Glib::ustring basePath,321 SubunitMusic::deserializeUpdateChild( std::string basePath, 322 322 Util::IODeserialize& deser ) 323 323 { trunk/libffado/src/libavc/musicsubunit/avc_musicsubunit.h
r1110 r1154 54 54 virtual const char* getName(); 55 55 protected: 56 virtual bool serializeChild( Glib::ustring basePath,56 virtual bool serializeChild( std::string basePath, 57 57 Util::IOSerialize& ser ) const; 58 virtual bool deserializeChild( Glib::ustring basePath,58 virtual bool deserializeChild( std::string basePath, 59 59 Util::IODeserialize& deser, 60 60 Unit& avDevice ); 61 virtual bool deserializeUpdateChild( Glib::ustring basePath,61 virtual bool deserializeUpdateChild( std::string basePath, 62 62 Util::IODeserialize& deser ); 63 63 trunk/libffado/src/libieee1394/configrom.cpp
r1073 r1154 398 398 } 399 399 400 const Glib::ustring400 const std::string 401 401 ConfigRom::getGuidString() const 402 402 { … … 405 405 ( unsigned int ) ( getGuid() >> 32 ), 406 406 ( unsigned int ) ( getGuid() & 0xffffffff ) ); 407 Glib::ustring result = buf;407 std::string result = buf; 408 408 free( buf ); 409 409 return result; 410 410 } 411 411 412 const Glib::ustring412 const std::string 413 413 ConfigRom::getModelName() const 414 414 { … … 439 439 } 440 440 441 const Glib::ustring441 const std::string 442 442 ConfigRom::getVendorName() const 443 443 { … … 599 599 600 600 bool 601 ConfigRom::serialize( Glib::ustring path, Util::IOSerialize& ser )601 ConfigRom::serialize( std::string path, Util::IOSerialize& ser ) 602 602 { 603 603 bool result; … … 605 605 result &= ser.write( path + "m_avcDevice", m_avcDevice ); 606 606 result &= ser.write( path + "m_guid", m_guid ); 607 result &= ser.write( path + "m_vendorName", Glib::ustring( m_vendorName ) );608 result &= ser.write( path + "m_modelName", Glib::ustring( m_modelName ) );607 result &= ser.write( path + "m_vendorName", std::string( m_vendorName ) ); 608 result &= ser.write( path + "m_modelName", std::string( m_modelName ) ); 609 609 result &= ser.write( path + "m_vendorId", m_vendorId ); 610 610 result &= ser.write( path + "m_modelId", m_modelId ); … … 624 624 625 625 ConfigRom* 626 ConfigRom::deserialize( Glib::ustring path, Util::IODeserialize& deser, Ieee1394Service& ieee1394Service )626 ConfigRom::deserialize( std::string path, Util::IODeserialize& deser, Ieee1394Service& ieee1394Service ) 627 627 { 628 628 ConfigRom* pConfigRom = new ConfigRom; trunk/libffado/src/libieee1394/configrom.h
r898 r1154 54 54 const fb_nodeid_t getNodeId() const; 55 55 const fb_octlet_t getGuid() const; 56 const Glib::ustring getGuidString() const;57 const Glib::ustring getModelName() const;58 const Glib::ustring getVendorName() const;56 const std::string getGuidString() const; 57 const std::string getModelName() const; 58 const std::string getVendorName() const; 59 59 60 60 const unsigned int getModelId() const; … … 100 100 static bool compareGUID( const ConfigRom& a, const ConfigRom& b ); 101 101 102 bool serialize( Glib::ustring path, Util::IOSerialize& ser );103 static ConfigRom* deserialize( Glib::ustring path,102 bool serialize( std::string path, Util::IOSerialize& ser ); 103 static ConfigRom* deserialize( std::string path, 104 104 Util::IODeserialize& deser, 105 105 Ieee1394Service& ieee1394Service ); … … 123 123 bool m_avcDevice; 124 124 fb_octlet_t m_guid; 125 Glib::ustring m_vendorName;126 Glib::ustring m_modelName;125 std::string m_vendorName; 126 std::string m_modelName; 127 127 unsigned int m_vendorId; 128 128 unsigned int m_modelId; trunk/libffado/src/libutil/OptionContainer.cpp
r864 r1154 108 108 109 109 bool 110 OptionContainer::Option::serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const110 OptionContainer::Option::serialize( std::string basePath, Util::IOSerialize& ser ) const 111 111 { 112 112 bool result; 113 result = ser.write( basePath + "m_Name", Glib::ustring(m_Name) );114 result &= ser.write( basePath + "m_stringValue", Glib::ustring(m_stringValue) );113 result = ser.write( basePath + "m_Name", std::string(m_Name) ); 114 result &= ser.write( basePath + "m_stringValue", std::string(m_stringValue) ); 115 115 result &= ser.write( basePath + "m_boolValue", m_boolValue ); 116 116 result &= ser.write( basePath + "m_doubleValue", m_doubleValue ); … … 124 124 125 125 OptionContainer::Option 126 OptionContainer::Option::deserialize( Glib::ustring basePath,126 OptionContainer::Option::deserialize( std::string basePath, 127 127 Util::IODeserialize& deser ) 128 128 { 129 129 bool result; 130 130 Option op=Option(); 131 Glib::ustring tmpstr;131 std::string tmpstr; 132 132 133 133 result = deser.read( basePath + "m_Name", tmpstr ); … … 412 412 413 413 bool 414 OptionContainer::serializeOptions( Glib::ustring basePath,414 OptionContainer::serializeOptions( std::string basePath, 415 415 Util::IOSerialize& ser) const 416 416 { … … 434 434 435 435 bool 436 OptionContainer::deserializeOptions( Glib::ustring basePath,436 OptionContainer::deserializeOptions( std::string basePath, 437 437 Util::IODeserialize& deser, 438 438 OptionContainer& container) trunk/libffado/src/libutil/OptionContainer.h
r864 r1154 74 74 75 75 public: // serialization support 76 bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const;77 static Option deserialize( Glib::ustring basePath,76 bool serialize( std::string basePath, Util::IOSerialize& ser ) const; 77 static Option deserialize( std::string basePath, 78 78 Util::IODeserialize& deser); 79 79 private: … … 153 153 154 154 protected: // serialization support 155 bool serializeOptions( Glib::ustring basePath,155 bool serializeOptions( std::string basePath, 156 156 Util::IOSerialize& ser) const; 157 static bool deserializeOptions( Glib::ustring basePath,157 static bool deserializeOptions( std::string basePath, 158 158 Util::IODeserialize& deser, 159 159 OptionContainer& container); trunk/libffado/src/libutil/serialize_expat.cpp
r864 r1154 1 1 /* 2 2 * Copyright (C) 2005-2008 by Daniel Wagner 3 * Copyright (C) 2005-2008 by Pieter Palmers 3 4 * 4 5 * This file is part of FFADO … … 31 32 IMPL_DEBUG_MODULE( Util::XMLDeserialize, XMLDeserialize, DEBUG_LEVEL_NORMAL ); 32 33 33 Util::XMLSerialize::XMLSerialize( Glib::ustring fileName )34 Util::XMLSerialize::XMLSerialize( std::string fileName ) 34 35 : IOSerialize() 35 36 , m_filepath( fileName ) … … 45 46 } 46 47 47 Util::XMLSerialize::XMLSerialize( Glib::ustring fileName, int verboseLevel )48 Util::XMLSerialize::XMLSerialize( std::string fileName, int verboseLevel ) 48 49 : IOSerialize() 49 50 , m_filepath( fileName ) … … 72 73 Util::XMLSerialize::writeVersion() 73 74 { 74 xmlpp::Node* pNode = m_doc.get_root_node(); 75 xmlpp::Element* pElem = pNode->add_child( "CacheVersion" ); 76 char* valstr; 77 asprintf( &valstr, "%s", CACHE_VERSION ); 78 pElem->set_child_text( valstr ); 79 free( valstr ); 75 Xml::Node* pNode = m_doc.get_root_node(); 76 if(pNode) { 77 char* valstr; 78 asprintf( &valstr, "%s", CACHE_VERSION ); 79 80 // check whether we already have a version node 81 Xml::Nodes versionfields = (*pNode)["CacheVersion"]; 82 83 if(versionfields.size()) { // set the value 84 versionfields.at(0)->set_child_text( valstr ); 85 } else { 86 // make a new field 87 Xml::Node &n = pNode->add( Xml::Node("CacheVersion", NULL) ); 88 n.set_child_text( valstr ); 89 } 90 free( valstr ); 91 } else { 92 debugError("No root node\n"); 93 } 80 94 } 81 95 … … 88 102 strMemberName.c_str(), value ); 89 103 90 vector<string> tokens;104 std::vector<std::string> tokens; 91 105 tokenize( strMemberName, tokens, "/" ); 92 106 … … 96 110 } 97 111 98 xmlpp::Node* pNode = m_doc.get_root_node(); 99 pNode = getNodePath( pNode, tokens ); 100 101 // element to be added 102 xmlpp::Element* pElem = pNode->add_child( tokens[tokens.size() - 1] ); 103 char* valstr; 104 asprintf( &valstr, "%lld", value ); 105 pElem->set_child_text( valstr ); 106 free( valstr ); 107 112 Xml::Node* pNode = m_doc.get_root_node(); 113 if(pNode) { 114 pNode = getNodePath( pNode, tokens ); 115 if(pNode) { 116 // element to be added 117 Xml::Node& n = pNode->add( Xml::Node(tokens[tokens.size() - 1].c_str(), NULL) ); 118 char* valstr; 119 asprintf( &valstr, "%lld", value ); 120 n.set_child_text( valstr ); 121 free( valstr ); 122 } else { 123 return false; 124 } 125 } else { 126 return false; 127 } 108 128 return true; 109 129 } … … 111 131 bool 112 132 Util::XMLSerialize::write( std::string strMemberName, 113 Glib::ustring str)133 std::string str) 114 134 { 115 135 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "write %s = %s\n", 116 136 strMemberName.c_str(), str.c_str() ); 117 137 118 vector<string> tokens;138 std::vector<std::string> tokens; 119 139 tokenize( strMemberName, tokens, "/" ); 120 140 … … 124 144 } 125 145 126 xmlpp::Node* pNode = m_doc.get_root_node(); 127 pNode = getNodePath( pNode, tokens ); 128 129 // element to be added 130 xmlpp::Element* pElem = pNode->add_child( tokens[tokens.size() - 1] ); 131 pElem->set_child_text( str ); 132 146 Xml::Node* pNode = m_doc.get_root_node(); 147 if(pNode) { 148 pNode = getNodePath( pNode, tokens ); 149 if(pNode) { 150 // element to be added 151 Xml::Node& n = pNode->add( Xml::Node(tokens[tokens.size() - 1].c_str(), NULL) ); 152 n.set_child_text( str ); 153 } else { 154 return false; 155 } 156 } else { 157 return false; 158 } 133 159 return true; 134 } 135 136 xmlpp::Node* 137 Util::XMLSerialize::getNodePath( xmlpp::Node* pRootNode, 160 161 } 162 163 Util::Xml::Node* 164 Util::XMLSerialize::getNodePath( Util::Xml::Node* pRootNode, 138 165 std::vector<string>& tokens ) 139 166 { … … 146 173 147 174 unsigned int iTokenIdx = 0; 148 xmlpp::Node* pCurNode = pRootNode;175 Xml::Node* pCurNode = pRootNode; 149 176 for (bool bFound = false; 150 177 ( iTokenIdx < tokens.size() - 1 ); 151 178 bFound = false, iTokenIdx++ ) 152 179 { 153 xmlpp::Node::NodeList nodeList = pCurNode->get_children();154 for ( xmlpp::Node::NodeList::iterator it = nodeList.begin();180 Xml::Node::Children& nodeList = pCurNode->children; 181 for ( Xml::Node::Children::iterator it = nodeList.begin(); 155 182 it != nodeList.end(); 156 183 ++it ) 157 184 { 158 if ( ( *it )->get_name() == tokens[iTokenIdx] ) { 159 pCurNode = *it; 185 Xml::Node* thisNode = &( *it ); 186 if ( thisNode->name.compare(tokens[iTokenIdx]) == 0 ) { 187 pCurNode = thisNode; 160 188 bFound = true; 161 189 break; … … 168 196 169 197 for ( unsigned int i = iTokenIdx; i < tokens.size() - 1; i++, iTokenIdx++ ) { 170 pCurNode = pCurNode->add_child( tokens[iTokenIdx] ); 198 Xml::Node& n = pCurNode->add( Xml::Node(tokens[iTokenIdx].c_str(), NULL) ); 199 pCurNode = &n; 171 200 } 172 201 return pCurNode; 173 174 202 } 175 203 176 204 /***********************************/ 177 205 178 Util::XMLDeserialize::XMLDeserialize( Glib::ustring fileName )206 Util::XMLDeserialize::XMLDeserialize( std::string fileName ) 179 207 : IODeserialize() 180 208 , m_filepath( fileName ) … … 183 211 setDebugLevel(DEBUG_LEVEL_NORMAL); 184 212 try { 185 m_parser.set_substitute_entities(); //We just want the text to213 // m_parser.set_substitute_entities(); //We just want the text to 186 214 //be resolved/unescaped 187 215 //automatically. 188 m_ parser.parse_file( m_filepath);216 m_doc.load_from_file(m_filepath); 189 217 } catch ( const exception& ex ) { 190 218 cout << "Exception caught: " << ex.what(); … … 192 220 } 193 221 194 Util::XMLDeserialize::XMLDeserialize( Glib::ustring fileName, int verboseLevel )222 Util::XMLDeserialize::XMLDeserialize( std::string fileName, int verboseLevel ) 195 223 : IODeserialize() 196 224 , m_filepath( fileName ) … … 199 227 setDebugLevel(verboseLevel); 200 228 try { 201 m_parser.set_substitute_entities(); //We just want the text to229 // m_parser.set_substitute_entities(); //We just want the text to 202 230 //be resolved/unescaped 203 231 //automatically. 204 m_ parser.parse_file( m_filepath);232 m_doc.load_from_file(m_filepath); 205 233 } catch ( const exception& ex ) { 206 234 cout << "Exception caught: " << ex.what(); … … 221 249 Util::XMLDeserialize::checkVersion() 222 250 { 223 Glib::ustring savedVersion;251 std::string savedVersion; 224 252 if (read( "CacheVersion", savedVersion )) { 225 Glib::ustring expectedVersion = CACHE_VERSION;253 std::string expectedVersion = CACHE_VERSION; 226 254 debugOutput( DEBUG_LEVEL_NORMAL, "Cache version: %s, expected: %s.\n", savedVersion.c_str(), expectedVersion.c_str() ); 227 255 if (expectedVersion == savedVersion) { … … 242 270 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "lookup %s\n", strMemberName.c_str() ); 243 271 244 xmlpp::Document *pDoc=m_parser.get_document(); 245 if(!pDoc) { 246 debugWarning( "no document found\n" ); 247 return false; 248 } 249 xmlpp::Node* pNode = pDoc->get_root_node(); 250 251 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "pNode = %s\n", pNode->get_name().c_str() ); 252 253 xmlpp::NodeSet nodeSet = pNode->find( strMemberName ); 254 for ( xmlpp::NodeSet::iterator it = nodeSet.begin(); 255 it != nodeSet.end(); 256 ++it ) 257 { 258 const xmlpp::Element* pElement = 259 dynamic_cast< const xmlpp::Element* >( *it ); 260 if ( pElement && pElement->has_child_text() ) { 261 char* tail; 262 value = strtoll( pElement->get_child_text()->get_content().c_str(), 263 &tail, 0 ); 264 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "found %s = %d\n", 265 strMemberName.c_str(), value ); 266 return true; 267 } 272 Xml::Node* pNode = m_doc.get_root_node(); 273 274 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "pNode = %s\n", pNode->name.c_str() ); 275 if(pNode) { 276 Xml::Nodes nodeSet = pNode->find( strMemberName ); 277 for ( Xml::Nodes::iterator it = nodeSet.begin(); 278 it != nodeSet.end(); 279 ++it ) 280 { 281 Xml::Node *n = *it; 282 if(n && n->has_child_text() ) { 283 char* tail; 284 value = strtoll( n->get_child_text().c_str(), 285 &tail, 0 ); 286 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "found %s = %d\n", 287 strMemberName.c_str(), value ); 288 return true; 289 } 290 debugWarning( "no such a node %s\n", strMemberName.c_str() ); 291 return false; 292 } 293 268 294 debugWarning( "no such a node %s\n", strMemberName.c_str() ); 269 295 return false; 270 } 271 272 debugWarning( "no such a node %s\n", strMemberName.c_str() );273 return false;296 } else { 297 debugError("No root node\n"); 298 return false; 299 } 274 300 } 275 301 276 302 bool 277 303 Util::XMLDeserialize::read( std::string strMemberName, 278 Glib::ustring& str )304 std::string& str ) 279 305 { 280 306 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "lookup %s\n", strMemberName.c_str() ); 281 307 282 xmlpp::Document *pDoc=m_parser.get_document(); 283 if(!pDoc) { 284 debugWarning( "no document found\n" ); 285 return false; 286 } 287 xmlpp::Node* pNode = pDoc->get_root_node(); 288 289 xmlpp::NodeSet nodeSet = pNode->find( strMemberName ); 290 for ( xmlpp::NodeSet::iterator it = nodeSet.begin(); 291 it != nodeSet.end(); 292 ++it ) 293 { 294 const xmlpp::Element* pElement = dynamic_cast< const xmlpp::Element* >( *it ); 295 if ( pElement ) { 296 if ( pElement->has_child_text() ) { 297 str = pElement->get_child_text()->get_content(); 298 } else { 299 str = ""; 308 Xml::Node* pNode = m_doc.get_root_node(); 309 310 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "pNode = %s\n", pNode->name.c_str() ); 311 if(pNode) { 312 Xml::Nodes nodeSet = pNode->find( strMemberName ); 313 for ( Xml::Nodes::iterator it = nodeSet.begin(); 314 it != nodeSet.end(); 315 ++it ) 316 { 317 Xml::Node *n = *it; 318 if(n) { 319 if(n->has_child_text() ) { 320 str = n->get_child_text(); 321 } else { 322 str = ""; 323 } 324 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "found %s = %s\n", 325 strMemberName.c_str(), str.c_str() ); 326 return true; 300 327 } 301 debug Output( DEBUG_LEVEL_VERY_VERBOSE, "found %s = %s\n",302 strMemberName.c_str(), str.c_str() );303 return true;304 }328 debugWarning( "no such a node %s\n", strMemberName.c_str() ); 329 return false; 330 } 331 305 332 debugWarning( "no such a node %s\n", strMemberName.c_str() ); 306 333 return false; 307 } 308 309 debugWarning( "no such a node %s\n", strMemberName.c_str() );310 return false;334 } else { 335 debugError("No root node\n"); 336 return false; 337 } 311 338 } 312 339 … … 314 341 Util::XMLDeserialize::isExisting( std::string strMemberName ) 315 342 { 316 xmlpp::Document *pDoc=m_parser.get_document(); 317 if(!pDoc) { 318 return false; 319 } 320 xmlpp::Node* pNode = pDoc->get_root_node(); 321 xmlpp::NodeSet nodeSet = pNode->find( strMemberName ); 322 return nodeSet.size() > 0; 343 Xml::Node* pNode = m_doc.get_root_node(); 344 if(pNode) { 345 Xml::Nodes nodeSet = pNode->find( strMemberName ); 346 return nodeSet.size() > 0; 347 } else return false; 323 348 } 324 349 trunk/libffado/src/libutil/serialize_expat.h
r864 r1154 1 1 /* 2 2 * Copyright (C) 2005-2008 by Daniel Wagner 3 * Copyright (C) 2005-2008 by Pieter Palmers 3 4 * 4 5 * This file is part of FFADO … … 22 23 */ 23 24 24 #ifndef bebob_serialize_h25 #define bebob_serialize_h25 #ifndef __FFADO_UTIL_SERIALIZE_EXPAT_H__ 26 #define __FFADO_UTIL_SERIALIZE_EXPAT_H__ 26 27 27 28 #include "debugmodule/debugmodule.h" 28 29 29 #include <libxml++/libxml++.h>30 #include "serialize_expat_xml.h" 30 31 31 32 #include <iostream> 33 #include <string> 32 34 33 35 namespace Util { … … 41 43 long long value ) = 0; 42 44 virtual bool write( std::string strMemberName, 43 Glib::ustring str) = 0;45 std::string str) = 0; 44 46 45 47 template <typename T> bool write( std::string strMemberName, T value ); … … 54 56 long long& value ) = 0; 55 57 virtual bool read( std::string strMemberName, 56 Glib::ustring& str ) = 0;58 std::string& str ) = 0; 57 59 58 60 template <typename T> bool read( std::string strMemberName, T& value ); … … 63 65 class XMLSerialize: public IOSerialize { 64 66 public: 65 XMLSerialize( Glib::ustring fileName );66 XMLSerialize( Glib::ustring fileName, int verboseLevel );67 XMLSerialize( std::string fileName ); 68 XMLSerialize( std::string fileName, int verboseLevel ); 67 69 virtual ~XMLSerialize(); 68 70 … … 70 72 long long value ); 71 73 virtual bool write( std::string strMemberName, 72 Glib::ustring str);74 std::string str); 73 75 private: 74 76 void writeVersion(); 75 77 76 Glib::ustringm_filepath;77 xmlpp::Documentm_doc;78 std::string m_filepath; 79 Xml::Document m_doc; 78 80 int m_verboseLevel; 79 81 80 82 DECLARE_DEBUG_MODULE; 81 83 82 xmlpp::Node* getNodePath( xmlpp::Node* pRootNode,83 84 Xml::Node* getNodePath( Xml::Node* pRootNode, 85 std::vector<std::string>& tokens ); 84 86 }; 85 87 86 88 class XMLDeserialize: public IODeserialize { 87 89 public: 88 XMLDeserialize( Glib::ustring fileName );89 XMLDeserialize( Glib::ustring fileName, int verboseLevel );90 XMLDeserialize( std::string fileName ); 91 XMLDeserialize( std::string fileName, int verboseLevel ); 90 92 virtual ~XMLDeserialize(); 91 93 … … 93 95 long long& value ); 94 96 virtual bool read( std::string strMemberName, 95 Glib::ustring& str );97 std::string& str ); 96 98 97 99 virtual bool isExisting( std::string strMemberName ); … … 99 101 bool checkVersion(); 100 102 private: 101 Glib::ustringm_filepath;102 xmlpp::DomParser m_parser;103 std::string m_filepath; 104 Xml::Document m_doc; 103 105 int m_verboseLevel; 104 106 trunk/libffado/src/libutil/serialize_libxml.cpp
r864 r1154 31 31 IMPL_DEBUG_MODULE( Util::XMLDeserialize, XMLDeserialize, DEBUG_LEVEL_NORMAL ); 32 32 33 Util::XMLSerialize::XMLSerialize( Glib::ustring fileName )33 Util::XMLSerialize::XMLSerialize( std::string fileName ) 34 34 : IOSerialize() 35 35 , m_filepath( fileName ) … … 45 45 } 46 46 47 Util::XMLSerialize::XMLSerialize( Glib::ustring fileName, int verboseLevel )47 Util::XMLSerialize::XMLSerialize( std::string fileName, int verboseLevel ) 48 48 : IOSerialize() 49 49 , m_filepath( fileName ) … … 111 111 bool 112 112 Util::XMLSerialize::write( std::string strMemberName, 113 Glib::ustring str)113 std::string str) 114 114 { 115 115 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "write %s = %s\n", … … 176 176 /***********************************/ 177 177 178 Util::XMLDeserialize::XMLDeserialize( Glib::ustring fileName )178 Util::XMLDeserialize::XMLDeserialize( std::string fileName ) 179 179 : IODeserialize() 180 180 , m_filepath( fileName ) … … 192 192 } 193 193 194 Util::XMLDeserialize::XMLDeserialize( Glib::ustring fileName, int verboseLevel )194 Util::XMLDeserialize::XMLDeserialize( std::string fileName, int verboseLevel ) 195 195 : IODeserialize() 196 196 , m_filepath( fileName ) … … 221 221 Util::XMLDeserialize::checkVersion() 222 222 { 223 Glib::ustring savedVersion;223 std::string savedVersion; 224 224 if (read( "CacheVersion", savedVersion )) { 225 225 Glib::ustring expectedVersion = CACHE_VERSION; … … 276 276 bool 277 277 Util::XMLDeserialize::read( std::string strMemberName, 278 Glib::ustring& str )278 std::string& str ) 279 279 { 280 280 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "lookup %s\n", strMemberName.c_str() ); trunk/libffado/src/libutil/serialize_libxml.h
r864 r1154 22 22 */ 23 23 24 #ifndef bebob_serialize_h25 #define bebob_serialize_h24 #ifndef __FFADO_UTIL_SERIALIZE_XMLPP_H__ 25 #define __FFADO_UTIL_SERIALIZE_XMLPP_H__ 26 26 27 27 #include "debugmodule/debugmodule.h" … … 30 30 31 31 #include <iostream> 32 #include <string> 32 33 33 34 namespace Util { … … 41 42 long long value ) = 0; 42 43 virtual bool write( std::string strMemberName, 43 Glib::ustring str) = 0;44 std::string str) = 0; 44 45 45 46 template <typename T> bool write( std::string strMemberName, T value ); … … 54 55 long long& value ) = 0; 55 56 virtual bool read( std::string strMemberName, 56 Glib::ustring& str ) = 0;57 std::string& str ) = 0; 57 58 58 59 template <typename T> bool read( std::string strMemberName, T& value ); … … 63 64 class XMLSerialize: public IOSerialize { 64 65 public: 65 XMLSerialize( Glib::ustring fileName );66 XMLSerialize( Glib::ustring fileName, int verboseLevel );66 XMLSerialize( std::string fileName ); 67 XMLSerialize( std::string fileName, int verboseLevel ); 67 68 virtual ~XMLSerialize(); 68 69 … … 70 71 long long value ); 71 72 virtual bool write( std::string strMemberName, 72 Glib::ustring str);73 std::string str); 73 74 private: 74 75 void writeVersion(); 75 76 76 Glib::ustring m_filepath;77 std::string m_filepath; 77 78 xmlpp::Document m_doc; 78 79 int m_verboseLevel; … … 86 87 class XMLDeserialize: public IODeserialize { 87 88 public: 88 XMLDeserialize( Glib::ustring fileName );89 XMLDeserialize( Glib::ustring fileName, int verboseLevel );89 XMLDeserialize( std::string fileName ); 90 XMLDeserialize( std::string fileName, int verboseLevel ); 90 91 virtual ~XMLDeserialize(); 91 92 … … 93 94 long long& value ); 94 95 virtual bool read( std::string strMemberName, 95 Glib::ustring& str );96 std::string& str ); 96 97 97 98 virtual bool isExisting( std::string strMemberName ); … … 99 100 bool checkVersion(); 100 101 private: 101 Glib::ustring m_filepath;102 std::string m_filepath; 102 103 xmlpp::DomParser m_parser; 103 104 int m_verboseLevel; trunk/libffado/src/libutil/unittests.cpp
r864 r1154 366 366 { 367 367 bool result; 368 result = ser.write( "m_pString", Glib::ustring( m_pString ) );368 result = ser.write( "m_pString", std::string( m_pString ) ); 369 369 return result; 370 370 } … … 374 374 { 375 375 bool result; 376 Glib::ustring str;376 std::string str; 377 377 result = deser.read( "m_pString", str ); 378 378 trunk/libffado/src/maudio/maudio_avdevice.cpp
r864 r1154 31 31 32 32 #include "debugmodule/debugmodule.h" 33 34 #include <libxml/xmlmemory.h>35 #include <libxml/parser.h>36 33 37 34 #include <string> trunk/libffado/src/SConscript
r1066 r1154 78 78 libutil/PosixThread.cpp \ 79 79 libutil/ringbuffer.c \ 80 libutil/serialize.cpp \81 80 libutil/StreamStatistics.cpp \ 82 81 libutil/SystemTimeSource.cpp \ … … 89 88 libcontrol/Nickname.cpp \ 90 89 ') 90 91 if env['SERIALIZE_USE_EXPAT']: 92 ffado_source.append('libutil/serialize_expat.cpp') 93 ffado_source.append('libutil/serialize_expat_xml.cpp') 94 else: 95 ffado_source.append('libutil/serialize_libxml.cpp') 96 91 97 92 98 bebob_source = env.Split( '\ … … 216 222 libenv.MergeFlags( env['LIBAVC1394_FLAGS'] ) 217 223 libenv.MergeFlags( env['LIBIEC61883_FLAGS'] ) 218 libenv.MergeFlags( env['LIBXML26_FLAGS'] ) 224 if not env['SERIALIZE_USE_EXPAT']: 225 libenv.MergeFlags( env['LIBXML26_FLAGS'] ) 226 else: 227 libenv.PrependUnique( LIBS=["expat"] ) 219 228 220 229 #env1.AppendUnique( LINKFLAGS = env.Split("-Wl,-rpath $libdir -Wl,-soname -Wl,libffado.so.1 --version-info=1:0:0") ) trunk/libffado/support/dbus/SConscript
r864 r1154 36 36 if not env.GetOption( "clean" ): 37 37 env.MergeFlags( env["DBUS1_FLAGS"] ) 38 env.MergeFlags( env['LIBRAW1394_FLAGS'] ) 39 env.MergeFlags( env['LIBXML26_FLAGS'] ) 38 if not env['SERIALIZE_USE_EXPAT']: 39 env.MergeFlags( env['LIBXML26_FLAGS'] ) 40 else: 41 env.PrependUnique( LIBS=["expat"] ) 40 42 41 43 env.Xml2Cpp_Proxy('controlclient-glue.h', 'control-interface.xml') trunk/libffado/support/firmware/SConscript
r900 r1154 33 33 env.MergeFlags( env['LIBAVC1394_FLAGS'] ) 34 34 env.MergeFlags( env['LIBIEC61883_FLAGS'] ) 35 env.MergeFlags( env['LIBXML26_FLAGS'] ) 35 if not env['SERIALIZE_USE_EXPAT']: 36 env.MergeFlags( env['LIBXML26_FLAGS'] ) 37 else: 38 env.PrependUnique( LIBS=["expat"] ) 36 39 37 40 static_env = env.Copy() trunk/libffado/tests/SConscript
r1121 r1154 32 32 if not env.GetOption( "clean" ): 33 33 env.MergeFlags( env['LIBRAW1394_FLAGS'] ) 34 env.MergeFlags( env['LIBXML26_FLAGS'] ) 34 if not env['SERIALIZE_USE_EXPAT']: 35 env.MergeFlags( env['LIBXML26_FLAGS'] ) 36 else: 37 env.PrependUnique( LIBS=["expat"] ) 35 38 36 39 static_env = env.Copy() trunk/libffado/tests/systemtests/SConscript
r1148 r1154 32 32 if not env.GetOption( "clean" ): 33 33 env.MergeFlags( env['LIBRAW1394_FLAGS'] ) 34 env.MergeFlags( env['LIBXML26_FLAGS'] )35 34 36 35 static_env = env.Copy()