1 #ifndef S11N_LITE_H_INCLUDED 2 #define S11N_LITE_H_INCLUDED 1 3 4 //////////////////////////////////////////////////////////////////////// 5 // headers which want to check for s11nlite's inclusion should check 6 // for: 7 #define s11n_S11NLITE_INCLUDED 1 8 // That's "the official way" to know if s11nlite is avaliable. 9 //////////////////////////////////////////////////////////////////////// 10 11 /** 12 s11nlite is a simplified subset of the s11n interface, combining 13 the APIs from the core and the s11n::io namespace into a single 14 API. It refines the s11n interface to almost-minimal, while still 15 leaving the full power of the underlying framework at clients' 16 disposals if they need it. It also provides a binding to the 17 default i/o implementation (the s11n::io-related Serializers), 18 meaning that clients don't have to deal with file formats at all, 19 and almost never even need to deal with the Serializer interface. 20 21 It is completely compatible with the core s11n framework, but 22 directly provides only a subset of the interface: those operations 23 common to most client-side use-cases, and those functions where 24 s11nlite can eliminate one of the required template parameters 25 (s11n's conventional NodeType argument, which s11nlite hard-codes 26 in its note_type typedef). 27 28 This implementation can easily be used as a basis for writing 29 custom client-side, s11n-based serialization frameworks. 30 31 Suggestions for including specific features into this interface are 32 of course welcomed. 33 34 Common conventions concerning this API: 35 36 - node_type must conform to s11n's S11n Node conventions. 37 38 - node_traits is equivalent to s11n::node_traits<node_type>. 39 40 - Serializers usable by this framework must be classloadable via 41 the serializer_interface classloader (including all that this 42 implies). 43 44 45 As of version 1.1, s11nlite is primarily a wrapper around the 46 type s11nlite::client_api<>. Many of s11nlite's functions 47 internally use a client_api instance to do their work. This 48 allows clients to swap out most of the s11nlite implementation 49 with their own at runtime, while still allowing all s11nlite 50 clients to use the same front-end API. 51 52 53 License: Do As You Damned Well Please 54 55 Author: stephan@s11n.net 56 */ 57 namespace s11nlite { /** here to please doxygen :( */ } 58 59 #include <memory> // auto_ptr 60 #include <iterator> // insert_interator<> 61 62 #include <s11n.net/s11n/s11n.hpp> // the core s11n framework 63 #include <s11n.net/s11n/io/data_node_io.hpp> // s11n::io::data_node_serializer class 64 #include <s11n.net/s11n/client_api.hpp> // the "real" implementation for most of s11nlite. 65 66 //Added by Damien to make Windows compile work 67 #include <s11n.net/s11n/export.hpp> // S11N_EXPORT_API 68 69 70 namespace s11nlite { 71 72 73 74 /** 75 client_interface defines the interface used/returned by the 76 instance() functions. By subclassing this type and 77 reimplmenting the appropriate virtual functions, a client-supplied 78 instance of this type can be plugged in as the primary s11nlite API 79 handler. This allows, for example, transparently adding compression 80 or network support to s11nlite. 81 */ 82 typedef client_api<s11n::s11n_node> client_interface; 83 84 /** 85 node_type is the type used to store/load a Serializable 86 object's data. 87 88 FYI: node_type might change to s11n::s11n_node in 1.1, 89 because that implementation is a tiny bit more lightweight 90 than s11n::data_node, and was designed specifically with 91 node_traits in mind (data_node came much earlier than 92 either of them). If you only use node_traits to access 93 nodes' data then your code will be oblivious to this change 94 (but will need a recompile). 95 */ 96 typedef client_interface::node_type node_type; 97 98 /** The s11n::node_traits type for node_type. */ 99 typedef client_interface::node_traits node_traits; 100 101 /** 102 This is the base-most type of the serializers used by s11nlite. 103 */ 104 typedef client_interface::serializer_interface serializer_interface; 105 106 /** 107 Returns the client_interface object used by the s11nlite 108 API. There is guaranteed to return *some* object, except 109 possibly post-main() (where all bets are off). 110 111 See instance(client_interface*) for more details. 112 */ 113 //Added by Damien to make Windows compile work 114 S11N_EXPORT_API client_interface & instance(); 115 116 /** 117 Sets the client_interface object used by the s11nlite 118 API. Ownership of newinstance IS NOT transfered. Passing 119 NULL will cause it to revert to the default instance. 120 newinstance must live as long as any client is using 121 s11nlite, and when newinstance is destroyed, 0 must be 122 passed to this function to disassociate the object from the 123 library. 124 */ 125 void instance( client_interface * newinstance ); 126 127 /** 128 Returns a new instance of the default serializer class. 129 130 The caller owns the returned pointer. 131 132 */ 133 serializer_interface * create_serializer(); 134 135 /** 136 Returns a new instance of the given serializer class, or 0 137 if one could not be loaded. classname must represent a subtype 138 of serializer_interface. 139 140 The caller owns the returned pointer. 141 142 You can also pass a serializer's cookie here, and that 143 should return the same thing as its class name would. 144 145 The internally-supported serializes all support a "friendly 146 form" of the name, an alias registered with their 147 classloader. Passing either this name or the cookie of the 148 Serializer should return the same thing as the classname 149 itself would. 150 151 Short-form names of internally-supported Serializers: 152 153 - compact (also called 51191011) 154 - expat (IF s11n was built with libexpat support) 155 - funtxt 156 - funxml 157 - parens 158 - simplexml 159 - wesnoth 160 161 Note that the short-form name is always the same as that of 162 the underlying Serializer class, minus the _serializer 163 suffix. This is purely a convention, and not a rule. This command 164 will use s11n::plugin support, if available, to dynamically 165 load new serializers. Simply name the DLL the same as the class, 166 without any namespace part in the filename, and your platform-specific 167 DLL file extension (e.g. .dll, .so, or .dynlib). 168 */ 169 serializer_interface * 170 create_serializer( const std::string & classname ); 171 172 173 /** 174 Sets the current Serializer class used by s11nlite's 175 create_serializer(). Pass it a class name, or one of the 176 convenience names listed in create_serializer(string). 177 */ 178 void serializer_class( const std::string & ); 179 180 /** 181 Gets the name of the current Serializer type. 182 */ 183 std::string serializer_class(); 184 185 186 /** 187 A non-const overload. Ownership is not modified by calling 188 this function: normally the parent node owns it. 189 */ 190 node_type * 191 find_child( node_type & parent, 192 const std::string subnodename ); 193 194 /** 195 Equivalent to s11n::find_child_by_name( parent, subnodename ). 196 */ 197 const node_type * 198 find_child( const node_type & parent, 199 const std::string subnodename ); 200 201 /** 202 See s11n::serialize(). 203 */ 204 template <typename SerializableType> serialize(node_type & dest,const SerializableType & src)205 bool serialize( node_type & dest, 206 const SerializableType & src ) 207 { 208 return instance().template serialize<SerializableType>( dest, src ); 209 } 210 211 /** 212 See s11n::serialize(). 213 */ 214 template <typename SerializableType> serialize_subnode(node_type & dest,const std::string & subnodename,const SerializableType & src)215 bool serialize_subnode( node_type & dest, 216 const std::string & subnodename, 217 const SerializableType & src ) 218 { 219 return instance().template serialize_subnode<SerializableType>( dest, subnodename, src ); 220 } 221 222 223 /** 224 Saves the given node to the given ostream using the default 225 serializer type. 226 227 Returns true on success, false on error. 228 229 ONLY use this for saving root nodes! 230 */ 231 bool save( const node_type & src, std::ostream & dest ); 232 233 /** 234 Saves the given node to the given filename using the default 235 serializer type. 236 237 Returns true on success, false on error. 238 239 ONLY use this for saving root nodes! 240 */ 241 bool save( const node_type & src, const std::string & filename ); 242 243 /** 244 Saves the given Serializable to the given ostream using the default 245 serializer type. 246 247 Returns true on success, false on error. 248 249 ONLY use this for saving root nodes! 250 */ 251 template <typename SerializableType> save(const SerializableType & src,std::ostream & dest)252 bool save( const SerializableType & src, std::ostream & dest ) 253 { 254 return instance().template save<SerializableType>( src, dest ); 255 } 256 /** 257 Saves the given Serializable to the given filename using the default 258 serializer type. 259 260 Returns true on success, false on error. 261 262 ONLY use this for saving root nodes! 263 */ 264 template <typename SerializableType> save(const SerializableType & src,const std::string & dest)265 bool save( const SerializableType & src, const std::string & dest ) 266 { 267 return instance().template save<SerializableType>(src,dest); 268 } 269 270 /** 271 Tries to load a node from the given filename. 272 273 The caller owns the returned pointer. 274 */ 275 node_type * load_node( const std::string & src ); 276 277 /** 278 Tries to load a node from the given input stream. 279 280 The caller owns the returned pointer. 281 282 Only usable for loading ROOT nodes. 283 */ 284 node_type * load_node( std::istream & src ); 285 286 287 /** 288 Tries to load a node_type from the given source. On 289 success, dest is set to the contents of that source and 290 true is returned, otherwise false is returned and dest is 291 untouched. 292 293 Added in versions 1.3.1 and 1.2.8. 294 */ 295 bool load_node( const std::string & src, node_type & dest ); 296 297 /** 298 Overloaded form taking an input stream instead of a string. 299 300 Added in versions 1.3.1 and 1.2.8. 301 */ 302 bool load_node( std::istream & src, node_type & dest ); 303 304 /** 305 See s11n::deserialize(). 306 307 ACHTUNG: if you are using both s11n and s11nlite 308 namespaces this function will be ambiguous with one provided 309 in the namespace s11n. You must then qualify it 310 with the namespace of the one you wish to use. 311 */ 312 template <typename SerializableType> deserialize(const node_type & src)313 SerializableType * deserialize( const node_type & src ) 314 { 315 return instance().template deserialize<SerializableType>( src ); 316 } 317 318 319 320 /** 321 Tries to deserialize src into target. Returns true on 322 success. If false is returned then target is not guaranteed 323 to be in a useful state: this depends entirely on the 324 object (but, it could be argued, it it was in a useful 325 state its deserialize operator would have returned true!). 326 327 DO NOT PASS A POINTER TYPE TO THIS FUNCTION. It will not do 328 what you want it to, and it will likely cause a leak. If 329 you want to directly deserialize to a pointer, use the 330 s11n::deserialize<>() overload which takes a reference to a 331 pointer. 332 */ 333 template <typename DeserializableT> deserialize(const node_type & src,DeserializableT & target)334 bool deserialize( const node_type & src, DeserializableT & target ) 335 { 336 return instance().template deserialize<DeserializableT>( src, target ); 337 } 338 339 340 /** 341 Exactly like deserialize(), but operates on a subnode of 342 src named subnodename. Returns false if no such file is 343 found. 344 */ 345 template <typename DeserializableT> deserialize_subnode(const node_type & src,const std::string & subnodename,DeserializableT & target)346 bool deserialize_subnode( const node_type & src, 347 const std::string & subnodename, 348 DeserializableT & target ) 349 { 350 return instance().template deserialize_subnode<DeserializableT>( src, subnodename, target ); 351 } 352 353 /** 354 Exactly like deserialize(), but operates on a subnode of 355 src named subnodename. Returns 0 if no such file is 356 found. 357 */ 358 template <typename DeserializableT> deserialize_subnode(const node_type & src,const std::string & subnodename)359 DeserializableT * deserialize_subnode( const node_type & src, 360 const std::string & subnodename ) 361 { 362 return instance().template deserialize_subnode<DeserializableT>( src, subnodename ); 363 } 364 365 366 /** 367 Tries to load a data_node from src, then deserialize that 368 to a SerializableType. 369 */ 370 template <typename SerializableType> load_serializable(std::istream & src)371 SerializableType * load_serializable( std::istream & src ) 372 { 373 return instance().template load_serializable<SerializableType>( src ); 374 } 375 376 /** 377 Overloaded form which takes a file name. 378 379 1.1.3: removed the never-used 2nd parameter. 380 */ 381 template <typename SerializableType> load_serializable(const std::string & src)382 SerializableType * load_serializable( const std::string & src ) 383 { 384 return instance().template load_serializable<SerializableType>( src ); 385 } 386 387 /** 388 See s11n::s11n_clone(). 389 390 This function was renamed from clone() in version 1.1. 391 */ 392 template <typename SerializableType> s11n_clone(const SerializableType & tocp)393 SerializableType * s11n_clone( const SerializableType & tocp ) 394 { 395 return instance().template clone<SerializableType>( tocp ); 396 } 397 398 /** 399 See s11n::s11n_cast(). 400 */ 401 template <typename Type1, typename Type2> s11n_cast(const Type1 & t1,Type2 & t2)402 bool s11n_cast( const Type1 & t1, Type2 & t2 ) 403 { 404 return instance().template cast<Type1,Type2>(t1,t2); 405 } 406 407 408 409 /** 410 A binary functor to save s-nodes and Serializables 411 using s11nlite::save(). 412 413 Added in version 1.1.3. 414 */ 415 struct save_binary_f 416 { 417 typedef ::s11nlite::node_type node_type; 418 419 /** 420 Returns save(src,dest). 421 */ operator ()s11nlite::save_binary_f422 inline bool operator()( node_type const & src, std::string const & dest ) const 423 { 424 return ::s11nlite::save( src, dest ); 425 } 426 427 /** 428 Returns save(src,dest). 429 */ operator ()s11nlite::save_binary_f430 inline bool operator()( node_type const & src, std::ostream & dest ) const 431 { 432 return ::s11nlite::save( src, dest ); 433 } 434 435 /** 436 Returns save(src,dest). 437 */ 438 template <typename SerT> operator ()s11nlite::save_binary_f439 inline bool operator()( SerT const & src, std::string const & dest ) const 440 { 441 return ::s11nlite::save( src, dest ); 442 } 443 444 /** 445 Returns save(src,dest). 446 */ 447 template <typename SerT> operator ()s11nlite::save_binary_f448 inline bool operator()( SerT const & src, std::ostream & dest ) const 449 { 450 return ::s11nlite::save( src, dest ); 451 } 452 453 454 }; 455 456 /** 457 A functor which forwards to s11nlite::save(node_type,string). 458 459 See save_stream_unary_f for notes about the parent classes. 460 Those same notes apply here. 461 462 Added in version 1.1.3. 463 */ 464 struct save_string_unary_f : ::s11n::serialize_unary_serializable_f_tag, 465 ::s11n::serialize_unary_node_f_tag 466 { 467 typedef ::s11nlite::node_type node_type; 468 const std::string destination; 469 /** 470 Specifies that operator() should send output to the 471 given resource name (normally, but not always, a 472 filename). 473 */ save_string_unary_fs11nlite::save_string_unary_f474 explicit save_string_unary_f( std::string const & s ) : destination(s) 475 {} 476 477 /** 478 Returns s11nlite:;save( src, this->destination ). 479 */ operator ()s11nlite::save_string_unary_f480 bool operator()( node_type const & src ) const 481 { 482 return ::s11nlite::save( src, this->destination ); 483 } 484 485 /** 486 Returns s11nlite:;save( src, this->destination ). 487 */ 488 template <typename SerT> operator ()s11nlite::save_string_unary_f489 bool operator()( SerT const & src ) const 490 { 491 return ::s11nlite::save( src, this->destination ); 492 } 493 }; 494 495 496 /** 497 A unary functor which forwards to 498 s11nlite::save(node_type|SerializableT,ostream). 499 500 Note that while this type conforms to two s11n-standard 501 tags (its parent classes), it is not *really* intended to 502 be used as a normal part of a serialization algorithm. That 503 said, that approach may indeed turn out to have some 504 interesting uses. It certainly has some pitfalls, in any 505 case, so don't blythely do it. 506 507 Added in version 1.1.3. 508 */ 509 struct save_stream_unary_f : ::s11n::serialize_unary_serializable_f_tag, 510 ::s11n::serialize_unary_node_f_tag 511 { 512 typedef ::s11nlite::node_type node_type; 513 std::ostream & stream; 514 /** 515 Specifies that operator() should send output to the 516 given stream. 517 */ save_stream_unary_fs11nlite::save_stream_unary_f518 explicit save_stream_unary_f( std::ostream & os ) : stream(os) 519 {} 520 521 /** 522 Returns s11nlite:;save( src, this->stream ). 523 */ operator ()s11nlite::save_stream_unary_f524 bool operator()( node_type const & src ) const 525 { 526 return ::s11nlite::save( src, this->stream ); 527 } 528 529 /** 530 Returns s11nlite:;save( src, this->stream ). 531 */ 532 template <typename SerT> operator ()s11nlite::save_stream_unary_f533 bool operator()( SerT const & src ) const 534 { 535 return ::s11nlite::save( src, this->stream ); 536 } 537 }; 538 539 540 /** 541 An "implementation detail" nullary functor type to simplify 542 implementations of save_xxx_nullary_f. It is not intended 543 for standalone use, but as a base type for 544 save_xxx_nullary_f functors. 545 546 T must be one of: 547 548 - s11nlite::node_type 549 550 - A non-cvp qualified Serializable type. 551 552 OutputT is expected to be one of: 553 554 - [const] std::string. NOT a reference, because we're 555 lazily evaluating and don't want to step on a dead 556 temporary. 557 558 - (std::ostream &) 559 560 If s11nlite::save() is ever overloaded, e.g., to take your 561 own custom output destination type, then that type will 562 also theoretically work here 563 564 See save() for important notes about when you should NOT 565 use this. In particular, this functor should not normally 566 be used with std::for_each(), as save() expects to store 567 ONE object in each target. Loading objects saved this way 568 won't work: only the first one is likely to be read by 569 load-time. Exceptions to this caveat include network 570 streams or debug channels. 571 572 Added in version 1.1.3. 573 574 */ 575 template <typename T,typename OutputT> 576 struct save_nullary_base_f 577 { 578 T const & source; 579 OutputT destination; 580 /** 581 Both src and dest are expected to outlive this 582 object, unless of source OutputT is a value type, 583 in which case we copy dest at ctor time, instead of 584 taking a (const &), to avoid us accidentally storing 585 a reference to a temporary which probably won't 586 exist when operator() is called. 587 */ save_nullary_base_fs11nlite::save_nullary_base_f588 save_nullary_base_f( T const & src, OutputT dest ) 589 : source(src), destination(dest) 590 {} 591 /** 592 Returns ::s11nlite::save( this->source, this->destination ). 593 */ operator ()s11nlite::save_nullary_base_f594 inline bool operator()() const 595 { 596 return ::s11nlite::save( this->source, this->destination ); 597 } 598 }; 599 600 /** 601 A nullary functor forwarding to s11nlite::save(node,string). 602 */ 603 struct save_node_string_nullary_f : save_nullary_base_f< ::s11nlite::node_type, const std::string > 604 { 605 typedef save_nullary_base_f< ::s11nlite::node_type, const std::string > parent_t; 606 typedef ::s11nlite::node_type node_type; 607 /** 608 See the notes in the base type API for requirements 609 of src and dest. 610 */ save_node_string_nullary_fs11nlite::save_node_string_nullary_f611 save_node_string_nullary_f( node_type const & src, std::string const & dest ) 612 : parent_t( src, dest ) 613 {} 614 615 }; 616 617 /** 618 A nullary functor forwarding to s11nlite::save(node,string). 619 620 */ 621 struct save_node_stream_nullary_f : save_nullary_base_f< ::s11nlite::node_type, std::ostream & > 622 { 623 typedef save_nullary_base_f< ::s11nlite::node_type, std::ostream & > parent_t; 624 typedef ::s11nlite::node_type node_type; 625 /** 626 See the notes in the base type API for requirements 627 of src and dest. 628 */ save_node_stream_nullary_fs11nlite::save_node_stream_nullary_f629 save_node_stream_nullary_f( node_type const & src, std::ostream & dest ) 630 : parent_t( src, dest ) 631 {} 632 }; 633 634 /** 635 A nullary functor forwarding to s11nlite::save(SerT,string). 636 */ 637 template <typename SerT> 638 struct save_serializable_string_nullary_f : save_nullary_base_f< SerT, const std::string > 639 { 640 typedef save_nullary_base_f< SerT, const std::string > parent_t; 641 /** 642 See the notes in the base type API for requirements 643 of src and dest. 644 */ save_serializable_string_nullary_fs11nlite::save_serializable_string_nullary_f645 save_serializable_string_nullary_f( SerT const & src, std::string const & dest ) 646 : parent_t( src, dest ) 647 {} 648 }; 649 650 /** 651 A nullary functor forwarding to s11nlite::save(Serializable,ostream). 652 */ 653 template <typename SerT> 654 struct save_serializable_stream_nullary_f : save_nullary_base_f< SerT, std::ostream & > 655 { 656 /** 657 See the notes in the base type API for requirements 658 of src and dest. 659 */ 660 typedef save_nullary_base_f< SerT, std::ostream & > parent_t; save_serializable_stream_nullary_fs11nlite::save_serializable_stream_nullary_f661 save_serializable_stream_nullary_f( SerT const & src, std::ostream & dest ) 662 : parent_t( src, dest ) 663 {} 664 }; 665 666 667 /** 668 Returns save_serializable_string_nullary_f<SerT>( src, dest ). 669 */ 670 template <typename SerT> 671 inline save_serializable_string_nullary_f<SerT> save_nullary_f(SerT const & src,std::string const & dest)672 save_nullary_f( SerT const & src, std::string const & dest ) 673 { 674 return save_serializable_string_nullary_f<SerT>( src, dest ); 675 } 676 677 /** 678 Returns save_serializable_stream_nullary_f<SerT>( src, dest ). 679 */ 680 template <typename SerT> 681 inline save_serializable_stream_nullary_f<SerT> save_nullary_f(SerT const & src,std::ostream & dest)682 save_nullary_f( SerT const & src, std::ostream & dest ) 683 { 684 return save_serializable_stream_nullary_f<SerT>( src, dest ); 685 } 686 687 /** 688 Returns save_node_string_nullary_f( src, dest ). 689 */ 690 inline save_node_string_nullary_f save_nullary_f(node_type const & src,std::string const & dest)691 save_nullary_f( node_type const & src, std::string const & dest ) 692 { 693 return save_node_string_nullary_f( src, dest ); 694 } 695 /** 696 Returns save_node_stream_nullary_f( src, dest ). 697 */ 698 inline save_node_stream_nullary_f save_nullary_f(node_type const & src,std::ostream & dest)699 save_nullary_f( node_type const & src, std::ostream & dest ) 700 { 701 return save_node_stream_nullary_f( src, dest ); 702 } 703 704 705 706 707 /** 708 A nullary functor to call s11nlite::load_node(istream&). 709 710 Added in version 1.1.3. 711 */ 712 struct load_node_stream_nullary_f 713 { 714 std::istream & stream; 715 typedef ::s11nlite::node_type node_type; 716 /** 717 Specifies that operator() should fetch input from the 718 given stream. 719 */ load_node_stream_nullary_fs11nlite::load_node_stream_nullary_f720 explicit load_node_stream_nullary_f( std::istream & s ) : stream(s) 721 {} 722 723 /** 724 Returns s11nlite::load_node( this->stream ), 725 726 Caller owns the returned object, which may be 0. 727 */ operator ()s11nlite::load_node_stream_nullary_f728 inline node_type * operator()() const 729 { 730 return ::s11nlite::load_node( this->stream ); 731 } 732 }; 733 734 /** 735 A nullary functor to call s11nlite::load_node(string). 736 */ 737 struct load_node_nullary_string_f 738 { 739 typedef ::s11nlite::node_type node_type; 740 const std::string resource; 741 /** 742 Specifies that operator() should fetch input from 743 the given resource name (normally, but not always, 744 a filename). 745 */ load_node_nullary_string_fs11nlite::load_node_nullary_string_f746 explicit load_node_nullary_string_f( std::string const & s ) : resource(s) 747 {} 748 749 /** 750 Returns s11nlite::load_node( this->resource ). 751 752 Caller owns the returned object, which may be 0. 753 */ operator ()s11nlite::load_node_nullary_string_f754 inline node_type * operator()() const 755 { 756 return ::s11nlite::load_node( this->resource ); 757 } 758 }; 759 760 761 /** 762 Returns load_node_nullary_string_f(s). 763 */ 764 inline load_node_nullary_string_f load_node_nullary_f(std::string const & s)765 load_node_nullary_f( std::string const & s ) 766 { 767 return load_node_nullary_string_f(s); 768 } 769 770 /** 771 Returns load_node_stream_nullary_f(s). 772 */ 773 inline load_node_stream_nullary_f load_node_nullary_f(std::istream & s)774 load_node_nullary_f( std::istream & s ) 775 { 776 return load_node_stream_nullary_f(s); 777 } 778 779 780 /** 781 A unary functor to call s11nlite::load_node(string|stream). 782 */ 783 struct load_node_unary_f 784 { 785 786 /** 787 Returns s11nlite::load_node( src ). 788 */ operator ()s11nlite::load_node_unary_f789 inline bool operator()( std::string const & src ) const 790 { 791 return ::s11nlite::load_node( src ); 792 } 793 794 /** 795 Returns s11nlite::load_node( src ). 796 */ operator ()s11nlite::load_node_unary_f797 inline bool operator()( std::istream & src ) const 798 { 799 return ::s11nlite::load_node( src ); 800 } 801 }; 802 803 804 } // namespace s11nlite 805 806 #endif // S11N_LITE_H_INCLUDED 807