pax_global_header00006660000000000000000000000064121650763160014521gustar00rootroot0000000000000052 comment=630de36df2ae9fefb1caf1f4abd76fada90fda36 libclaw-1.7.4/000077500000000000000000000000001216507631600131475ustar00rootroot00000000000000libclaw-1.7.4/CMakeLists.txt000066400000000000000000000220431216507631600157100ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) IF(CMAKE_COMPILER_IS_GNUCXX) ADD_DEFINITIONS(-Wall -ansi -pedantic) ENDIF(CMAKE_COMPILER_IS_GNUCXX) project(claw) include_directories(.) set( CLAW_VERSION_MAJOR 1 ) set( CLAW_VERSION_MINOR 7 ) set( CLAW_RELEASE_NUMBER 4 ) set( CLAW_VERSION ${CLAW_VERSION_MAJOR}.${CLAW_VERSION_MINOR}.${CLAW_RELEASE_NUMBER} ) set(CLAW_REVISION_NUMBER 0) find_file(SVN_ENTRIES ".svn/entries" PATH ${CMAKE_CURRENT_SOURCE_DIR}) if(SVN_ENTRIES) find_package(Subversion) if(Subversion_FOUND) Subversion_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} INFO) set(CLAW_REVISION_NUMBER ${INFO_WC_REVISION}) endif(Subversion_FOUND) endif(SVN_ENTRIES) set( CLAW_CODE_DIR claw/code/ ) set( CLAW_INCLUDE_DIRECTORY "${CMAKE_INSTALL_PREFIX}/include/" ) set( CLAW_INSTALLDIR_SOURCE include/claw/ ) set( CLAW_INSTALLDIR_LIB lib/ ) set( CLAW_INSTALLDIR_DOC share/doc/libclaw${CLAW_VERSION_MAJOR}/ ) set( CLAW_TRANSLATIONS_INSTALL_DIR "share/locale" ) set( CLAW_EXECUTABLE_DIR bin/ ) set( CLAW_LIBRARIES claw_application claw_configuration_file claw_dynamic_library claw_graphic claw_logger claw_net claw_tween ) # custom build options option( CLAW_NO_JPEG "Turn off jpeg support" OFF ) option( CLAW_NO_PNG "Turn off png support" OFF ) option( CLAW_INSTALL_CMAKE_MODULES "Install cmake modules for CLAW" ON ) #------------------------------------------------------------------------------- # look for the jpeg library if( CLAW_NO_JPEG ) else( CLAW_NO_JPEG ) include( ${CMAKE_ROOT}/Modules/FindJPEG.cmake ) set( CLAW_DEFINITIONS ${CLAW_DEFINITIONS} -DCLAW_JPEG_SUPPORT ) include_directories(${JPEG_INCLUDE_DIR}) endif( CLAW_NO_JPEG ) # look for the png library if( CLAW_NO_PNG ) else( CLAW_NO_PNG ) include( ${CMAKE_ROOT}/Modules/FindPNG.cmake ) set( CLAW_DEFINITIONS ${CLAW_DEFINITIONS} -DCLAW_PNG_SUPPORT ) include_directories(${PNG_INCLUDE_DIR}) endif( CLAW_NO_PNG ) #------------------------------------------------------------------------------- # set compilation defines add_definitions( ${CLAW_DEFINITIONS} ) #------------------------------------------------------------------------------- # application set( CLAW_APPLICATION_SOURCES ${CLAW_CODE_DIR}application.cpp ${CLAW_CODE_DIR}arguments.cpp ${CLAW_CODE_DIR}arguments_table.cpp ) add_library( claw_application SHARED ${CLAW_APPLICATION_SOURCES} ) add_library( claw_application-static ${CLAW_APPLICATION_SOURCES} ) target_link_libraries( claw_application claw_logger ) if( NOT WIN32 ) set_target_properties( claw_application PROPERTIES COMPILE_DEFINITIONS "CLAW_TEXT_DOMAIN_PATH=${CMAKE_INSTALL_PREFIX}/${CLAW_TRANSLATIONS_INSTALL_DIR}" ) set_target_properties( claw_application-static PROPERTIES COMPILE_DEFINITIONS "CLAW_TEXT_DOMAIN_PATH=${CMAKE_INSTALL_PREFIX}/${CLAW_TRANSLATIONS_INSTALL_DIR}" ) endif( NOT WIN32 ) # configuration file set( CLAW_CONFIGURATION_FILE_SOURCES ${CLAW_CODE_DIR}configuration_file.cpp ) add_library( claw_configuration_file SHARED ${CLAW_CONFIGURATION_FILE_SOURCES} ) add_library( claw_configuration_file-static STATIC ${CLAW_CONFIGURATION_FILE_SOURCES} ) # dynamic libraries set( CLAW_DYNAMIC_LIBRARY_SOURCES ${CLAW_CODE_DIR}dynamic_library.cpp ) add_library( claw_dynamic_library SHARED ${CLAW_DYNAMIC_LIBRARY_SOURCES} ) add_library( claw_dynamic_library-static STATIC ${CLAW_DYNAMIC_LIBRARY_SOURCES} ) target_link_libraries( claw_dynamic_library ${CMAKE_DL_LIBS} ) # log system set( CLAW_LOGGER_SOURCES ${CLAW_CODE_DIR}logger.cpp ${CLAW_CODE_DIR}log_stream.cpp ${CLAW_CODE_DIR}log_stream_concise.cpp ${CLAW_CODE_DIR}log_stream_uniq.cpp ${CLAW_CODE_DIR}log_level.cpp ) add_library( claw_logger SHARED ${CLAW_LOGGER_SOURCES} ) add_library( claw_logger-static STATIC ${CLAW_LOGGER_SOURCES} ) if( WIN32 ) target_link_libraries( claw_logger intl ) set_target_properties( claw_logger-static PROPERTIES COMPILE_FLAGS "-DCLAW_LOGGER_NO_EXPORT" ) endif( WIN32 ) # network set( CLAW_NET_SOURCES ${CLAW_CODE_DIR}basic_socket.cpp ${CLAW_CODE_DIR}socket_server.cpp ) add_library( claw_net SHARED ${CLAW_NET_SOURCES} ) add_library( claw_net-static STATIC ${CLAW_NET_SOURCES} ) if( WIN32 ) target_link_libraries( claw_net wsock32 ) endif( WIN32 ) # graphic set( CLAW_GRAPHIC_LIBRARIES ) set( CLAW_GRAPHIC_SOURCES ${CLAW_CODE_DIR}image.cpp ${CLAW_CODE_DIR}bitmap.cpp ${CLAW_CODE_DIR}bitmap_writer.cpp ${CLAW_CODE_DIR}bitmap_reader.cpp ${CLAW_CODE_DIR}gif.cpp ${CLAW_CODE_DIR}gif_frame.cpp ${CLAW_CODE_DIR}gif_reader.cpp ${CLAW_CODE_DIR}pcx.cpp ${CLAW_CODE_DIR}pcx_reader.cpp ${CLAW_CODE_DIR}pcx_writer.cpp ${CLAW_CODE_DIR}pixel.cpp ${CLAW_CODE_DIR}targa.cpp ${CLAW_CODE_DIR}targa_writer.cpp ${CLAW_CODE_DIR}targa_reader.cpp ${CLAW_CODE_DIR}targa_file_structure.cpp ${CLAW_CODE_DIR}xbm.cpp ${CLAW_CODE_DIR}xbm_reader.cpp ${CLAW_CODE_DIR}xbm_writer.cpp ) # check jpeg library if( JPEG_FOUND ) set( CLAW_GRAPHIC_LIBRARIES ${CLAW_GRAPHIC_LIBRARIES} ${JPEG_LIBRARIES} ) set( CLAW_GRAPHIC_SOURCES ${CLAW_GRAPHIC_SOURCES} ${CLAW_CODE_DIR}jpeg.cpp ${CLAW_CODE_DIR}jpeg_reader.cpp ${CLAW_CODE_DIR}jpeg_writer.cpp ${CLAW_CODE_DIR}jpeg_error_manager.cpp ) else( JPEG_FOUND ) message( "jpeg library not found." ) endif( JPEG_FOUND ) # check png library if( PNG_FOUND ) set( CLAW_GRAPHIC_LIBRARIES ${CLAW_GRAPHIC_LIBRARIES} ${PNG_LIBRARIES} ) set( CLAW_GRAPHIC_SOURCES ${CLAW_GRAPHIC_SOURCES} ${CLAW_CODE_DIR}png.cpp ${CLAW_CODE_DIR}png_reader.cpp ${CLAW_CODE_DIR}png_writer.cpp ) else( PNG_FOUND ) message( "png library not found." ) endif( PNG_FOUND ) add_library( claw_graphic SHARED ${CLAW_GRAPHIC_SOURCES} ) add_library( claw_graphic-static STATIC ${CLAW_GRAPHIC_SOURCES} ) target_link_libraries(claw_graphic ${CLAW_GRAPHIC_LIBRARIES}) # tween set( CLAW_TWEEN_SOURCES ${CLAW_CODE_DIR}tween/base_tweener.cpp ${CLAW_CODE_DIR}tween/single_tweener.cpp ${CLAW_CODE_DIR}tween/tweener.cpp ${CLAW_CODE_DIR}tween/tweener_group.cpp ${CLAW_CODE_DIR}tween/tweener_sequence.cpp ${CLAW_CODE_DIR}tween/easing/easing_circ.cpp ${CLAW_CODE_DIR}tween/easing/easing_none.cpp ${CLAW_CODE_DIR}tween/easing/easing_linear.cpp ${CLAW_CODE_DIR}tween/easing/easing_elastic.cpp ${CLAW_CODE_DIR}tween/easing/easing_quint.cpp ${CLAW_CODE_DIR}tween/easing/easing_cubic.cpp ${CLAW_CODE_DIR}tween/easing/easing_back.cpp ${CLAW_CODE_DIR}tween/easing/easing_quad.cpp ${CLAW_CODE_DIR}tween/easing/easing_sine.cpp ${CLAW_CODE_DIR}tween/easing/easing_quart.cpp ${CLAW_CODE_DIR}tween/easing/easing_bounce.cpp ${CLAW_CODE_DIR}tween/easing/easing_expo.cpp ) include(FindBoost) find_package( Boost 1.42 ) if( NOT Boost_FOUND ) message( FATAL_ERROR "Can't find Boost library on version greater or equal to 1.42 on your system." ) endif( NOT Boost_FOUND ) #------------------------------------------------------------------------------- # Include directories for Boost include_directories( ${Boost_INCLUDE_DIR} ) add_library( claw_tween SHARED ${CLAW_TWEEN_SOURCES} ) add_library( claw_tween-static STATIC ${CLAW_TWEEN_SOURCES} ) # extra flags for the link set_target_properties( ${CLAW_LIBRARIES} PROPERTIES LINK_FLAGS "-s -Wl,--as-needed" ) # all libraries set( CLAW_ALL_LIBRARIES ${CLAW_LIBRARIES} ${CLAW_GRAPHIC_LIBRARIES}) #------------------------------------------------------------------------------- # subdirectories subdirs( doc claw desktop ) #------------------------------------------------------------------------------- # install libraries foreach( lib ${CLAW_LIBRARIES} ) set_target_properties( ${lib} PROPERTIES VERSION ${CLAW_VERSION} SOVERSION ${CLAW_VERSION_MAJOR} ) set_target_properties( ${lib}-static PROPERTIES OUTPUT_NAME ${lib} CLEAN_DIRECT_OUTPUT 1 ) install( TARGETS ${lib} DESTINATION ${CLAW_INSTALLDIR_LIB} ) install( TARGETS ${lib}-static DESTINATION ${CLAW_INSTALLDIR_LIB} ) endforeach( lib ) install( FILES COPYING DESTINATION ${CLAW_INSTALLDIR_DOC} ) # target to uninstall files configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") if(UNIX) # configuration script configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/claw-config.in" "${CMAKE_CURRENT_BINARY_DIR}/claw-config" IMMEDIATE @ONLY) install( FILES "${CMAKE_CURRENT_BINARY_DIR}/claw-config" DESTINATION ${CLAW_EXECUTABLE_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) endif(UNIX) # version configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/claw/version.hpp.in" "${CMAKE_CURRENT_BINARY_DIR}/claw/version.hpp" ) install( FILES "${CMAKE_CURRENT_BINARY_DIR}/claw/version.hpp" DESTINATION "${CLAW_INSTALLDIR_SOURCE}" ) if(WIN32) subdirs(win) endif(WIN32) # check if we have to install cmake modules if( CLAW_INSTALL_CMAKE_MODULES ) subdirs( cmake-module ) endif( CLAW_INSTALL_CMAKE_MODULES ) libclaw-1.7.4/COPYING000066400000000000000000000575071216507631600142200ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS libclaw-1.7.4/ChangeLog000066400000000000000000000356141216507631600147320ustar00rootroot000000000000002013-07-03 Julien Jorge * version 1.7.4 * claw - Installs a version file for CMake. * claw::graphic - Fixes the end iterator on the image instances. - Fixes the image merge algorithm. - Fixes the loading of grayscale PNGs with an alpha channel. * claw::tween - Adds the getters on single_tweener. 2013-03-14 Julien Jorge * version 1.7.3 * claw - The static libraries are built with the correct name. * claw::tween - Tweeners added in groups are not updated on a zero duration nor immediately removed if they are finished, thanks Benjamin Schulz. - Replace the usage of M_PI by boost::math::constants::pi<>(). 2012-11-03 Julien Jorge * version 1.7.2 * claw - Add a script to ease the compilation for Windows using Wine. * claw::graphic:png - Add missing #include , thanks Tibor Bamhor. 2012-07-05 Julien Jorge * version 1.7.1 * claw - Fix compilation issues with gcc 4.7 * claw::math - Add a method to compute the smallest bounding box of two rectangles. - Add a curve class to manipulate Bézier curves. * claw::tween - The tweeners can receive callbacks that will be executed when the tweener is finished. - Adds some workarounds to compile the tweeners with XCode. Thanks to Anton Rutkevich. 2011-07-24 Julien Jorge * version 1.7.0 * claw - A command line argument of pattern key=value can receive an empty string. * claw::graphic - Add a constructor to each pixel class to constructo the color from a string representing an hexadecimal color code. * claw::math - Add a method to rotate a point around an other one. - Add a method to get the angle of the line made by two points relatively to the x-axis. - Add comparison operators for claw::math::rectangle. * claw::meta - Add a method to multi_type_map to get the number of values in the map. - Add a method to insert all the values of an other map into a map. - Add some methods to erase values from a multi_type_map. - Add a type list containing all C++ types. - Add a metaprog class type_list_contains to check if a type list contains a given type. - Add a visitor class to visit all the (key, value) pairs in a multi_type_map. * claw::pattern - factory is a singleton only if CLAW_FACTORY_IS_SINGLETON is defined. * claw::tween - New library containing classes for data interpolation in time, also known as inbetweening or tweeners. 2010-10-24 Julien Jorge * version 1.6.0 * claw::graphic: - Added support for reading GIF files. - Added a function to merge images. - Added the function image::fill() to fill a rectangle with a given colour. - rgba_pixel is a structure. * claw::configuration_file: - The fields can now be modified. - Added an iterator type on the name of the fields. - Added an iterator type on the name of the sections. - Added a function to clear a section. - Added a function to check if a field exists. * claw::meta: - Added some classes to ease the use of type lists. - Added a structure to split a type list in two lists according to given delimiter. - Split meta.hpp into several files. - multi_type_map can now be iterated for a given type. - multi_type_map now only work with type lists. - Added a class to check if a type is derived from an other type. * claw::text: - Added the c_escape function to escape characters in strings, like in c-strings. * claw::math: - Added the function box_2d::join() to join boxes. - Added a method in box_2d to check if the box is empty. * General: - Better implementation of max_vector, a structure used to store a set of "maximum" items from a range. Items are compared according to a given criterion. - Added a function claw::replace() to replace a set of values by other values in a sequence. - Added a function claw::glob_match() to check if a sequence matches a given pattern, similar to the behaviour of the terminals. - Do not fail when reading in a never opened socked, just return eof(). - Add missing operator it_index<>::operator->(). - Use gettext to translate messages. Translations are available in French and Norwegian. - Added a real_number class to manipulate floating points number using an epsilon value for comparisons. * Design patterns - The namespace has been renamed 'pattern'. - Added the factory design pattern. * Log system: - Fix wrong return type of claw::log_system::operator<<(). - Add a log stream 'log_stream_uniq' that does not output successively the same message. - Add a log stream 'log_stream_concise' that does not output a line that have been recently been output. 2009-06-15 Julien Jorge * version 1.5.4 * claw::graphic: - Better name for pixel classes. Added default colors. - Comparison operators for the pixels. * claw::math: - Added methods for intersection, cast, size, edge-coordinate and inclusion in box_2d - Added methods to easily get and set the position of the edges and corners of a box_2d - Replaced vector_2d::get_orthonormal by two methods allowing to chose the direction * claw::arguments_table: - By default, arguments table gives no allowed arguments. - Add support for multiples arguments with the same name. * claw::memory: - Add comparison operators in smart_ptr. * claw::logger: - std::endl can be used on claw::logger. * claw::graph: - Allow to create graphs whose edges have no specified type. 2008-07-05 Julien Jorge * version 1.5.3 * A release with minor changes: - Fix compilation issues with g++ 4.3 - Set the soname of the libraries - Fix some warnings of cmake and ld - Create html documentation at compilation time - The assertion macros call abort() instead of exit() - Split the implementation and the interface of the AVL - Added a private operator=() to the class non_copyable 2008-01-12 Julien Jorge * version 1.5.2b * claw::text: - Added a getline method that removes the tailing '\r'. 2008-01-07 Julien Jorge * version 1.5.1b * general: - Port to x86_64. - Port to FreeBSD (and all *BSD), thanks to patches from David Le Brun. 2008-01-01 Julien Jorge * version 1.5.0b * general: - Improved/updated the example programs. - Updated installation script for windows. - Improved windows port. - Lot of bug fixes. * claw::first, claw::pair_first, claw::second, claw::pair_second: split the const/non-const methods into two separate classes. * claw::graphic: - Added reading and writing support for xpm files - Added reading support for 8 bits per pixel targa files - Added reading and writing support for pcx files. - Allow to build zero-width or zero-height images. * claw::math: - The claw::math::rectangle class now work as expected in general. IT BREAKS THE COMPATIBILITY WITH PREVIOUS VERSIONS: The difference concerns mainly the right() and bottom() methods of the rectangle class: (new) rectangle::right() == (old) rectangle::right() + 1 * claw::lzw_encoder, claw::lzw_decoder: Added those classes to help encoding/decoding data with the LZW algorithm. * claw::istream_input_buffer: Renamed claw::buffered_istream. Now it detects the end of the stream. It can also be tested (bool) to check if there is more data. * claw::buffered_ostream: New class that write in a stream using a buffer. * claw::bit_istream, claw::bit_ostream: classes to help reading and writing custom bit length data into streams. * claw::tree: a class to manage a tree of any degree. * claw::wrapped_iterator: a class to iterate through transformed elements of a container. 2007-03-14 Julien Jorge * version 1.4.2b * general: - rectified some mistakes in the FindCLAW.cmake CMake module. - added the CLAW_CMAKE_MODULES_INSTALL_PATH variable for the CMake scripts, so the user can choose where the abovementioned module will be installed. - fixed linking problems under Mandriva 2007 * claw::math: splitted the math.hpp file into several headers (one for each class). * claw::text: added the split() method that splits a string in a sequence of tokens, given a separator. * claw::graphic::pixel32: - added a constructor taking the components values as parameters. - added the disequality operator. * claw::concept::singleton: new implementation guarantying that the instance is destroyed at the end of the execution (bug fix #1653689). * claw::log_system, claw::logger: added support for managing several log streams. 2007-01-13 Julien Jorge * version 1.4.1b * general: - updated the code so it works under Windows (tested with Windows XP and MinGW). - simplified the use of Claw with CMake. * claw::kmp: bug fix. #1632755 * claw::logger: added __declspec(dll{import,export}) decorations (needed by Windows). * claw::system_info: added support for Window. 2006-11-26 Julien Jorge * version 1.4.0b * general: translated some comments from english to french. 2006-11-05 Julien Jorge * claw::meta: Create the namespace. Some classes for meta-programming: - if_then_else: conditional type declaration. - same_type: test if two types are the same. - type_list: a list of types. - type_list_find: check if a type is in a given type_list. - type_list_is_a_set: test if a each type in a type_list is present only once. * claw::memory::smart_ptr: smart pointers (automatically release the memory when it is not pointed) with references count. * claw::multi_type_map: a kind of map that can support values of different types associated with the same key. 2006-10-29 Julien Jorge * claw::system_info: Created the class. Support unix systems only for the moment. 2006-10-22 Julien Jorge * claw::configuration_file: created the class. * claw::arguments_table: bug fix. The parameters of the long argument were not saved when calling the add() method. 2006-10-18 Julien Jorge * claw::arguments_table: - Added a method to check if required arguments are set. - Modified the help() method to print the required fields before optional ones. 2006-10-16 Julien Jorge * version 1.3.1b * claw::net: Bug fix. Fixed bug #1578027. Sockets worked only on local host. 2006-10-14 Julien Jorge * version 1.3.0b * claw::avl: - Added the assignment operator. - Added the insert() method taking a range of values. * claw::math::rectangle: - Added the includes( rectangle ) method, to check if a rectangle is inside an other one. - Added the size() method, to get the size of the rectangle with one function call. - Small bug fix in claw::math::rectangle constructor with two claw::math::coordinate_2d. * claw::math::box_2d: Added a constructor from two math::coordinate_2d<> for the position and the size. * claw::math::coordinate_2d: Added the unary minus operator. * claw::math::vector_2d: Added a constructor with two coordinates (the head and the tail). * claw::math:point_2d: deprecated. Moved its "distance()" method in the math::coordinate_2d class. * claw::logger: bug fix. Buffer overflow risk in the write method. * claw::graphic::png: new class. Support of the PNG image format (read/write). * claw::graphic::jpeg: Added writing support for JPEG images. * claw::graphic::image: Added a load( std::istream& ) method to load any type of supported format. * claw::graphic::targa: bug fix. The signature was incorrect (checking and writing). WARNING: All targa file wrote with previous versions aren't valid. * general: - Replaced SCons with cmake. - Added a general example for the claw::graphic::image class and subclasses. Removed examples for bitmap and jpeg. - New script to get options and libraries needed when using Claw. 2006-07-18 Julien Jorge * version 1.2.1b * claw::graphic::targa: Bug fix. An invalid code was output when calling ::file_output_buffer::raw() and the /remaining/ variable was zero. 2006-07-10 Julien Jorge * version 1.2.0b * claw::unary_compose: new class. Function object that composes two function objects. * claw::delete_function: new class. Function object that deletes a pointer. * claw::pair_first, claw::pair_second: new classes. Equivalent to the *first* and *second* classes, but take std::pair as template arguments. * claw::clone: new class. Function object that clones a pointer. * claw::arguments_table: new class. A class to manage the arguments of your program, with automatic management of short/long arguments and help message. * claw::socket_traits: new class. Common interface for platform specific methods needed for using sockets. Now we can use sockets under linux or windows. * claw::rle_encoder, claw::rle_decoder: new classes. Classes to help encoding/decoding RLE streams. * claw::graphic::color_palette: new class. A class that manage the color palette in palettized images. * claw::istream_input_buffer: new class. This class is made to help reading istreams with a buffer. * claw::graphic::jpeg: new class. An image class for jpeg file loading. * claw::graphic::targa: - Added methods for saving (un)compressed targa files. - Added methods for reading RLE targas. - Modified so it can be read from std::istream (more generic than std::ifstream). - Bug fix. When reading non-32 bits targas, the transparency was incorrect. * claw::graphic::bitmap: - Added loading support for (un)compressed monochrome, 4 bpp and 8 bpp bitmaps. - Modified so it can be read from std::istream (more generic than std::ifstream). * claw::graphic::image: - Changed allocation mode. Data is allocated each line at once, - Removed the pixels methods. - Added the iterator class. * claw::application: Use the new claw::arguments_table class instead of the claw::arguments class. * claw::graph: Translated the last french method names to english names. * claw::arguments: bug fix. The program name wasn't removed from the argument list. * claw::math::line_2d<>: bug fix. Corrected mistakes in the intersection() method. * general: - Added an example program for the claw::graphic::jpeg class. - Added the string_algorithm package, - Added new asserts for pre/post conditions testing. libclaw-1.7.4/INSTALL000066400000000000000000000033211216507631600141770ustar00rootroot00000000000000CLAW LIBRARY: INSTALLATION NOTES SUMMARY: 1. INSTALL 2. UNINSTALL 3. OPTIONS -- 1. INSTALL -- You need cmake to install this library and also Boost 1.42. Maybe libjpeg 6b and libpng 1.2.8 too. These two libraries are required by default but can be disabled (see the OPTIONS below). Be sure to NOT turn off the use of libjpeg or libpng if they are required by the program you compile libclaw for. If you have a doubt, I recommend to keep the default settings. If you want html documentation, be sure you have "doxygen" installed. Go in the libclaw- directory. For the full installation, type : cmake . -DOPTION1 -DOPTION2 ... make make install # as root See below to know what 'OPTION' can be. -- 2. UNINSTALL -- To remove the files you've installed, just type make uninstall # as root -- 3. OPTIONS -- You can customize your installation with the following options. CLAW_NO_JPEG={true|false} Deactivate or activate jpeg support (default is false) CLAW_NO_PNG={true|false} Deactivate or activate png support (default is false) CLAW_INSTALL_CMAKE_MODULES={true|false} Activate or deactivate the installation of the CMake modules for Claw (default is true) CLAW_CMAKE_MODULES_INSTALL_PATH= Allow you to select the directory in which the CMake modules of Claw will be installed (useful if you define a special installation prefix). these are cmake options: CMAKE_INSTALL_PREFIX= Directory in which the files will be installed (default is /usr/local) CMAKE_BUILD_TYPE={debug|release|profile} Activate or deactivate code debugging/profiling where : {a|b} means either 'a' or 'b' is a path to a directory. libclaw-1.7.4/claw-config.in000077500000000000000000000061001216507631600156700ustar00rootroot00000000000000#!/bin/sh prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} exec_prefix_set=no CLAW_INCLUDE_DIRECTORY=$(echo "@CLAW_INCLUDE_DIRECTORY@" | sed 's/;/ /g') CLAW_DEFINITIONS=$(echo "@CLAW_DEFINITIONS@" | sed 's/;/ /g') CLAW_VERSION="@CLAW_VERSION@" # Flags telling which parts of the CLAW library the user want FLAG_ALL_LIBRARIES=0 FLAG_CONFIGURATION_FILE_LIBRARIES=0 FLAG_APPLICATION_LIBRARIES=0 FLAG_DYNAMIC_LIBRARY_LIBRARIES=0 FLAG_GRAPHIC_LIBRARIES=0 FLAG_LOGGER_LIBRARIES=0 FLAG_NET_LIBRARIES=0 FLAG_TWEEN_LIBRARIES=0 usage="Usage: claw-config [all|application|configuration_file|dynamic_library|graphic|logger|net|tween] [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]" print_libraries() { if [ $FLAG_ALL_LIBRARIES -eq 1 ] then FLAG_APPLICATION_LIBRARIES=1 FLAG_CONFIGURATION_FILE_LIBRARIES=1 FLAG_DYNAMIC_LIBRARY_LIBRARIES=1 FLAG_GRAPHIC_LIBRARIES=1 FLAG_LOGGER_LIBRARIES=1 FLAG_NET_LIBRARIES=1 FLAG_TWEEN_LIBRARIES=1 fi if [ $FLAG_APPLICATION_LIBRARIES -eq 1 ] then echo -n "-lclaw_application -lclaw_logger " fi if [ $FLAG_DYNAMIC_LIBRARY_LIBRARIES -eq 1 ] then echo -n "-lclaw_dynamic_library -ldl " fi if [ $FLAG_CONFIGURATION_FILE_LIBRARIES -eq 1 ] then echo -n "-lclaw_configuration_file " fi if [ $FLAG_GRAPHIC_LIBRARIES -eq 1 ] then echo -n "-lclaw_graphic " if echo "$CLAW_DEFINITIONS" | grep -q "CLAW_PNG_SUPPORT" then echo -n "-lpng -lz " fi if echo "$CLAW_DEFINITIONS" | grep -q "CLAW_JPEG_SUPPORT" then echo -n "-ljpeg " fi fi if [ $FLAG_LOGGER_LIBRARIES -eq 1 ] then echo -n "-lclaw_logger " fi if [ $FLAG_NET_LIBRARIES -eq 1 ] then echo -n "-lclaw_net " fi if [ $FLAG_TWEEN_LIBRARIES -eq 1 ] then echo -n "-lclaw_tween " fi echo } if test $# -eq 0; then echo "${usage}" 1>&2 exit 1 fi while test $# -gt 0; do case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac case $1 in all) FLAG_ALL_LIBRARIES=1 ;; application) FLAG_APPLICATION_LIBRARIES=1 ;; configuration_file) FLAG_CONFIGURATION_FILE_LIBRARIES=1 ;; dynamic_library) FLAG_DYNAMIC_LIBRARY_LIBRARIES=1 ;; graphic) FLAG_GRAPHIC_LIBRARIES=1 ;; logger) FLAG_LOGGER_LIBRARIES=1 ;; net) FLAG_NET_LIBRARIES=1 ;; --prefix=*) prefix=$optarg if test $exec_prefix_set = no ; then exec_prefix=$optarg fi ;; --prefix) echo $prefix ;; --exec-prefix=*) exec_prefix=$optarg exec_prefix_set=yes ;; --exec-prefix) echo $exec_prefix ;; --version) echo $CLAW_VERSION ;; --cflags|--cppflags|--cxxflags) echo -I$CLAW_INCLUDE_DIRECTORY $CLAW_DEFINITIONS ;; --include) echo -I$CLAW_INCLUDE_DIRECTORY ;; --libs) libdirs="-L${exec_prefix}/lib " echo -n "$libdirs" echo $(print_libraries) ;; *) echo "${usage}" 1>&2 exit 1 ;; esac shift done libclaw-1.7.4/claw/000077500000000000000000000000001216507631600140755ustar00rootroot00000000000000libclaw-1.7.4/claw/CMakeLists.txt000066400000000000000000000004541216507631600166400ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw) subdirs( impl ) file(GLOB CLAW_HEADERS "*.hpp") install( FILES ${CLAW_HEADERS} DESTINATION "${CLAW_INSTALLDIR_SOURCE}" ) install( DIRECTORY meta tween DESTINATION "${CLAW_INSTALLDIR_SOURCE}" PATTERN "*~" EXCLUDE PATTERN ".svn" EXCLUDE ) libclaw-1.7.4/claw/algorithm.hpp000066400000000000000000000035061216507631600166000ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file algorithm.hpp * \brief Generic algorithms on sequences. * \author Julien Jorge */ #ifndef __CLAW_ALGORITHM_HPP__ #define __CLAW_ALGORITHM_HPP__ namespace claw { template UnaryFunction inplace_for_each ( InputIterator first, InputIterator last, UnaryFunction f ); template ForwardIterator1 find_first_not_of ( ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2 ); template std::size_t replace ( ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 e1_first, ForwardIterator2 e1_last, ForwardIterator3 e2_first, ForwardIterator3 e2_last ); } // namespace claw #include #endif // __CLAW_ALGORITHM_HPP__ libclaw-1.7.4/claw/application.hpp000066400000000000000000000045131216507631600171140ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file application.hpp * \brief A class to represent the application. * \author Julien Jorge */ #ifndef __CLAW_APPLICATION_HPP__ #define __CLAW_APPLICATION_HPP__ #include /** * \brief Use this macro to implement your application's class. If you want to * implement your application class named my_app, write somewhere in your * code (no semi column at the end of the line) : * CLAW_APPLICATION_IMPLEMENT(my_app) * \pre App must inerhit from claw::application. */ #define CLAW_APPLICATION_IMPLEMENT(App) \ int main(int argc, char** argv) \ { \ App app(argc, argv); \ return app.run(); \ } \ namespace claw { /** * \brief A class to represent the application. * * The claw::application understand the following command line arguments : * - --log-file=string Sets the file in which the logs are written, * - --log-level=integer Sets the log level. * * \author Julien Jorge */ class application { public: application( int& argc, char** &argv ); virtual ~application(); virtual int run() = 0; protected: /** \brief The arguments passed by the system. */ arguments_table m_arguments; }; // class application } // namespace claw #endif // __CLAW_APPLICATION_HPP__ libclaw-1.7.4/claw/arguments.hpp000066400000000000000000000071261216507631600166210ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file arguments.hpp * \brief A class to manage the arguments of your program. * \author Julien Jorge */ #ifndef __CLAW_ARGUMENTS_HPP__ #define __CLAW_ARGUMENTS_HPP__ #include #include #include namespace claw { /** * \brief A class to manage the arguments of your program. * * This class will handle all arguments of type -l[=val] or --long[=val]. * * \remark None of those methods is allowed to use claw::logger because when * we are processing the arguments, we are at the really begining of * the program and claw::logger is probably not initialised. * * \author Julien Jorge */ class arguments { private: typedef std::map< std::string, std::list > valued_arguments_map; public: arguments(); explicit arguments( const std::string& prog_name ); arguments( int& argc, char** &argv ); arguments( int& argc, char** &argv, const claw::math::ordered_set& allowed ); void parse( int& argc, char** &argv ); void parse( int& argc, char** &argv, const claw::math::ordered_set& allowed ); bool has_value( const std::string& arg_name ) const; bool only_integer_values( const std::string& arg_name ) const; bool only_real_values( const std::string& arg_name ) const; const std::string& get_program_name() const; bool get_bool( const std::string& arg_name ) const; int get_integer( const std::string& arg_name ) const; double get_real( const std::string& arg_name ) const; const std::string& get_string( const std::string& arg_name ) const; std::list get_all_of_integer( const std::string& arg_name ) const; std::list get_all_of_real( const std::string& arg_name ) const; std::list get_all_of_string( const std::string& arg_name ) const; void add_argument( const std::string& arg ); private: void parse( int& argc, char** &argv, bool always_allowed, const claw::math::ordered_set& allowed ); bool split_argument ( const std::string& arg, std::string& name, std::string& value ) const; void remove_null_arguments( int& argc, char** &argv ) const; void process_boolean ( char* &arg, bool always_allowed, const claw::math::ordered_set& allowed ); private: /** \brief The name of the program. */ std::string m_program_name; /** \brief yes/no arguments. */ claw::math::ordered_set m_flags; /** \brief Arguments of type key=value. */ valued_arguments_map m_pairs; }; // class arguments } // namespace claw #endif // __CLAW_ARGUMENTS_HPP__ libclaw-1.7.4/claw/arguments_table.hpp000066400000000000000000000120101216507631600177540ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file arguments_table.hpp * \brief A class to manage the arguments of your program, with automatic * management of short/long arguments and help message. * \author Julien Jorge */ #ifndef __CLAW_ARGUMENTS_TABLE_HPP__ #define __CLAW_ARGUMENTS_TABLE_HPP__ #include namespace claw { /** * \brief A class to manage the arguments of your program, with automatic * management of short/long arguments and help message. * * \remark None of those methods is allowed to use claw::logger because when * we are processing the arguments, we are at the really begining of * the program and claw::logger is probably not initialised. * * \author Julien Jorge */ class arguments_table { private: /** * \brief This class manage the description of an argument. * \author Julien Jorge. */ class argument_attributes { public: argument_attributes( const std::string& name, const std::string& second_name, const std::string& help_message, bool optional, const std::string& value_type ); bool operator<( const argument_attributes& that ) const; std::string format_short_help() const; std::string format_long_help() const; const std::string& get_name() const; const std::string& get_second_name() const; bool is_optional() const; private: /** \brief The principal name of the argument. */ const std::string m_name; /** \brief The second name of the argument. */ const std::string m_second_name; /** \brief Message describing the argument. */ const std::string m_help_message; /** \brief Tell if the argument is optional. */ const bool m_optional; /** \brief The type of the value needed by this argument. */ const std::string m_value_type; }; // class argument_attributes public: explicit arguments_table( const std::string& prog_name ); arguments_table( int& argc, char** &argv ); void add( const std::string& short_name, const std::string& long_name, const std::string& help_msg = "", bool optional = false, const std::string& val_name = "" ); void add_long( const std::string& long_name, const std::string& help_msg = "", bool optional = false, const std::string& val_name = "" ); void add_short( const std::string& short_name, const std::string& help_msg = "", bool optional = false, const std::string& val_name = "" ); void parse( int& argc, char** &argv ); void help( const std::string& free_args = "" ) const; bool required_fields_are_set() const; bool has_value( const std::string& arg_name ) const; bool only_integer_values( const std::string& arg_name ) const; bool only_real_values( const std::string& arg_name ) const; const std::string& get_program_name() const; bool get_bool( const std::string& arg_name ) const; int get_integer( const std::string& arg_name ) const; double get_real( const std::string& arg_name ) const; const std::string& get_string( const std::string& arg_name ) const; std::list get_all_of_integer( const std::string& arg_name ) const; std::list get_all_of_real( const std::string& arg_name ) const; std::list get_all_of_string( const std::string& arg_name ) const; void add_argument( const std::string& arg ); private: void get_argument_names( const std::string& arg_name, std::string& short_name, std::string& long_name ) const; private: /** \brief The class that will store arguments values. */ arguments m_arguments; /** \brief The arguments with a short version. */ math::ordered_set m_short_arguments; /** \brief The arguments with a long version. */ math::ordered_set m_long_arguments; }; // class arguments_table } // namespace claw #endif // __CLAW_ARGUMENTS_TABLE_HPP__ libclaw-1.7.4/claw/assert.hpp000066400000000000000000000066721216507631600161220ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file assert.hpp * \brief Some assert macros to strengthen you code. * \author Julien Jorge */ #ifndef __CLAW_ASSERT_HPP__ #define __CLAW_ASSERT_HPP__ #include #include #include /** * \fn CLAW_ASSERT( b, s ) * \brief Print a message on std::cerr and stop the program if a condition is * not true. * \param b Condition to verify. * \param s An error message. */ /** * \fn CLAW_FAIL( s ) * \brief Print a message on std::cerr and stop the program. * \param s An error message. */ /** * \fn CLAW_PRECOND( b ) * \brief Abort the program if a precondition is not true. * \param b Condition to verify. */ /** * \fn CLAW_POSTCOND( b ) * \brief Abort the program if a postcondition is not true. * \param b Condition to verify. */ #ifndef NDEBUG namespace claw { /*-------------------------------------------------------------------------*/ /** * \brief The method used by CLAW_ASSERT macro. Souldn't be used elsewhere. * \param file The file where the error is produced. * \param func The name of the current function. * \param line The line where the error is produced. * \param b A boolean condition to verify. * \param s Message printed if b is not verified. */ inline void debug_assert( const char* file, const char* func, unsigned int line, bool b, const std::string& s ) { if ( !(b) ) { std::cerr << file << ":" << line << "\n\t" << func << " : assertion failed\n\t" << s << std::endl; #ifndef CLAW_SOFT_ASSERT abort(); #endif } } // claw::debug_assert() } // namespace claw /*---------------------------------------------------------------------------*/ #define CLAW_ASSERT( b, s ) \ claw::debug_assert( __FILE__, __FUNCTION__, __LINE__, (b), (s) ) /*---------------------------------------------------------------------------*/ #define CLAW_FAIL( s ) \ claw::debug_assert( __FILE__, __FUNCTION__, __LINE__, false, (s) ) /*---------------------------------------------------------------------------*/ #define CLAW_PRECOND( b ) CLAW_ASSERT( b, "precondition failed: " #b ) /*---------------------------------------------------------------------------*/ #define CLAW_POSTCOND( b ) CLAW_ASSERT( b, "postcondition failed: " #b ) #else // def NDEBUG #define CLAW_ASSERT( b, s ) #define CLAW_FAIL( s ) #define CLAW_PRECOND( b ) #define CLAW_POSTCOND( b ) #endif // NDEBUG #endif // __CLAW_ASSERT_HPP__ libclaw-1.7.4/claw/automaton.hpp000066400000000000000000000113561216507631600166230ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file automaton.hpp * \brief A basic automaton structure. * \author Julien Jorge */ #ifndef __CLAW_AUTOMATON_HPP__ #define __CLAW_AUTOMATON_HPP__ #include #include #include namespace claw { //***************************** automate ************************************ /** * \brief Basic automaton structure. * * An automaton is a quintuplet (A, E, I ,F, T) where * - A is the set of symbols, * - E is the set of states, * - I is the set of initial states, * - F is the set of finalstates, * - T is the set of transitions (labeled edges) * * \b Template \b parameters * - \a State The type of the states. * - \a Edge The type of the symbols in the alphabet. */ template, class EdgeComp = std::less > class automaton { public: /** \brief The type of the states. */ typedef State state_type; /** \brief The type of the symbols on the edges. */ typedef Edge edge_type; /** \brief The type of the operator used to compare states. */ typedef StateComp state_compare; /** \brief The type of the operator used to compare edge symbols. */ typedef EdgeComp edge_compare; /** \brief The neighbours list associates states to edge symbols.*/ typedef std::multimap neighbours_list; /** \brief Each state is given a set of reachable states with a neighbours list. */ typedef std::map adjacent_list; /** \brief The return type of the methods returning states. */ typedef std::vector result_state_list; /** \brief The return type of the methods returning edges. */ typedef std::vector result_edge_list; public: void add_edge( const state_type& s1, const state_type& s2, const edge_type& e ); void remove_edge( const state_type& s1, const state_type& s2, const edge_type& e ); void add_state( const state_type& s ); void add_initial_state( const state_type& s ); void add_final_state( const state_type& s ); bool state_exists( const state_type& s ) const; bool state_is_final( const state_type& s ) const; bool state_is_initial( const state_type& s ) const; void states( result_state_list& v ) const; void final_states( result_state_list& v ) const; void initial_states( result_state_list& v ) const; void alphabet( result_edge_list& v ) const; template bool match(InputIterator first, InputIterator last) const; unsigned int states_count() const; void reachables( const state_type& s, const edge_type& e, result_state_list& l ) const; void reachables( const state_type& s, result_state_list& l ) const; void edges( const state_type& s1, const state_type& s2, result_edge_list& l ) const; void edges( const state_type& s1, const edge_type& edge, result_edge_list& l ) const; private: template bool match_aux(const state_type& s, InputIterator first, InputIterator last) const; private: /** \brief The predicate used to compare states. */ static state_compare s_state_compare; /** \brief The set of symbols in the alphabet. */ avl m_alphabet; /** \brief The set of initial states. */ avl m_initial_states; /** \brief The set of final states. */ avl m_final_states; /** \brief The adjacency list (the set of transitions). */ adjacent_list m_states; }; // automaton } // namespace claw #include #endif // __CLAW_AUTOMATON_HPP__ libclaw-1.7.4/claw/avl.hpp000066400000000000000000000063521216507631600153760ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file avl.hpp * \brief AVL Binary search tree. * \author Julien Jorge */ #ifndef __CLAW_AVL_HPP__ #define __CLAW_AVL_HPP__ #include namespace claw { //--------------------------------------------------------------------------- /** * \brief Binary search tree AVL implementation. * \author Julien Jorge */ template < class K, class Comp = std::less > class avl { private: /** \brief The type of the implementation of this tree. */ typedef avl_base impl_type; public: /** \brief The type of the values in the tree. */ typedef K value_type; /** \brief The type of the keys in the tree. */ typedef K key_type; /** \brief The type passed to the template. */ typedef K referent_type; /** \brief The comparator to use to compare the keys. */ typedef Comp key_less; /** \brief The type of a const reference on the values. */ typedef const K& const_reference; /** \brief The type of the iterator on the values of the tree. */ typedef typename impl_type::avl_const_iterator const_iterator; public: avl(); explicit avl( const avl& that ); template avl( InputIterator first, InputIterator last ); void insert( const K& key ); template void insert( InputIterator first, InputIterator last ); void erase( const K& key ); void clear(); unsigned int size() const; bool empty() const; const_iterator begin() const; const_iterator end() const; const_iterator find( const K& key ) const; const_iterator find_nearest_greater( const K& key ) const; const_iterator find_nearest_lower( const K& key ) const; const_iterator lower_bound() const; const_iterator upper_bound() const; avl& operator=( const avl& that ); bool operator==( const avl& that ) const; bool operator!=( const avl& that ) const; bool operator<( const avl& that ) const; bool operator>( const avl& that ) const; bool operator<=( const avl& that ) const; bool operator>=( const avl& that ) const; private: /** \brief Implementation. */ impl_type m_tree; }; // class avl } // namespace claw #include #endif // __CLAW_AVL_HPP__ libclaw-1.7.4/claw/avl_base.hpp000066400000000000000000000226261216507631600163720ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file avl_base.hpp * \brief Base implementation for the AVL Binary search tree. * \author Julien Jorge */ #ifndef __CLAW_AVL_BASE_HPP__ #define __CLAW_AVL_BASE_HPP__ #include #include #include namespace claw { //--------------------------------------------------------------------------- /** * \brief Binary search tree base AVL implementation. * * Each key appears only once. Nodes are sorted as * left_child < node < right_child. * \invariant this->empty() <==> (this->size() == 0) * \invariant this is an AVL. * \remark Type requirements : * - K is LessThanComparable ; * - Comp is a binary predicate such that Comp(K a, K b) == true if a < b. * \remark Code is taken from a C implementation, so perhaps it doesn't * really look nice for C++. Nevertheless it works perfectly and it's * fast conversion : that good things. * \author Julien Jorge */ template < class K, class Comp = std::less > class avl_base { private: //**************************** avl_node *********************************** /** * \brief Node of a binary search tree (AVL). */ class avl_node: public binary_node< typename claw::avl_base::avl_node > { private: /** \brief The type of the parent class. */ typedef binary_node< typename claw::avl_base::avl_node > super; public: explicit avl_node( const K& k ); ~avl_node(); avl_node* duplicate( unsigned int& count ) const; void del_tree(); unsigned int depth() const; avl_node* find( const K& k ); const avl_node* find( const K& k ) const; avl_node* find_nearest_greater( const K& key ); const avl_node* find_nearest_greater( const K& key ) const; avl_node* find_nearest_lower( const K& key ); const avl_node* find_nearest_lower( const K& key ) const; avl_node* lower_bound(); const avl_node* lower_bound() const; avl_node* upper_bound(); const avl_node* upper_bound() const; avl_node* prev(); const avl_node* prev() const; avl_node* next(); const avl_node* next() const; private: explicit avl_node( const avl_node& that ); public: /** \brief Node key */ K key; /** * \brief Balance of the node is -1, 0 or 1. * Equals to the difference between left child depth and right child * depth. */ char balance; /** \brief Father of the node. Null if this node is root */ avl_node *father; }; // class avl_node private: typedef avl_node* avl_node_ptr; typedef avl_node const* const_avl_node_ptr; public: //*************************** avl::avl_iterator *************************** /** * \brief AVL iterator. */ class avl_iterator { public: typedef K value_type; typedef K& reference; typedef K* const pointer; typedef ptrdiff_t difference_type; typedef std::bidirectional_iterator_tag iterator_category; public: avl_iterator(); avl_iterator( avl_node_ptr node, bool final ); avl_iterator& operator++(); avl_iterator operator++(int); avl_iterator& operator--(); avl_iterator operator--(int); reference operator*() const; pointer operator->() const; bool operator==(const avl_iterator& it) const; bool operator!=(const avl_iterator& it) const; private: /** \brief Current node in the tree. */ avl_node_ptr m_current; /** \brief True if we've gone past the last node. */ bool m_is_final; }; // class avl_iterator /** * \brief AVL iterator. */ class avl_const_iterator { public: typedef K value_type; typedef const K& reference; typedef const K* const pointer; typedef ptrdiff_t difference_type; typedef std::bidirectional_iterator_tag iterator_category; public: avl_const_iterator(); avl_const_iterator( const_avl_node_ptr node, bool final ); avl_const_iterator& operator++(); avl_const_iterator operator++(int); avl_const_iterator& operator--(); avl_const_iterator operator--(int); reference operator*() const; pointer operator->() const; bool operator==(const avl_const_iterator& it) const; bool operator!=(const avl_const_iterator& it) const; private: /** \brief Current node in the tree. */ const_avl_node_ptr m_current; /** \brief True if we've gone past the last node. */ bool m_is_final; }; // class avl_const_iterator public: typedef K value_type; typedef K key_type; typedef K referent_type; typedef Comp key_less; typedef const K& const_reference; typedef avl_iterator iterator; typedef avl_const_iterator const_iterator; public: //**************************** avl_base (main) ***************************** avl_base(); explicit avl_base( const avl_base& that ); ~avl_base(); void insert( const K& key ); template void insert( Iterator first, Iterator last ); void erase( const K& key ); void clear(); inline unsigned int size() const; inline bool empty() const; iterator begin(); const_iterator begin() const; iterator end(); const_iterator end() const; iterator find( const K& key ); const_iterator find( const K& key ) const; iterator find_nearest_greater( const K& key ); const_iterator find_nearest_greater( const K& key ) const; iterator find_nearest_lower( const K& key ); const_iterator find_nearest_lower( const K& key ) const; iterator lower_bound(); const_iterator lower_bound() const; iterator upper_bound(); const_iterator upper_bound() const; avl_base& operator=( const avl_base& that ); bool operator==( const avl_base& that ) const; bool operator!=( const avl_base& that ) const; bool operator<( const avl_base& that ) const; bool operator>( const avl_base& that ) const; bool operator<=( const avl_base& that ) const; bool operator>=( const avl_base& that ) const; void swap( avl_base& that ); private: //------------------------------------------------------------------------- // We need some methods to check the validity of our trees bool check_in_bounds( const avl_node_ptr node, const K& min, const K& max ) const; bool check_balance( const avl_node_ptr node ) const; bool correct_descendant( const avl_node_ptr node ) const; bool validity_check() const; private: iterator make_iterator( avl_node_ptr node ) const; const_iterator make_const_iterator( const_avl_node_ptr node ) const; //------------------------------------------------------------------------- // Tree management methods void rotate_right( avl_node_ptr& node ); void rotate_left( avl_node_ptr& node ); void rotate_left_right( avl_node_ptr& node ); void rotate_right_left( avl_node_ptr& node ); void update_balance( avl_node_ptr node, const K& key ); void adjust_balance( avl_node_ptr& node ); void adjust_balance_left( avl_node_ptr& node ); void adjust_balance_right( avl_node_ptr& node ); //------------------------------------------------------------------------- // Methods for insertion //------------------------------------------------------------------------- void insert_node( const K& key ); avl_node_ptr* find_node_reference( const K& key, avl_node_ptr& last_imbalanced, avl_node_ptr& node_father); //------------------------------------------------------------------------- // Methods for deletion //------------------------------------------------------------------------- bool recursive_delete( avl_node_ptr& node, const K& key ); bool new_balance( avl_node_ptr& node, int imbalance ); bool recursive_delete_node( avl_node_ptr& node ); int recursive_delete_max( avl_node_ptr& root, avl_node_ptr node ); public: /** \brief Function object used to compare keys. */ static key_less s_key_less; private: /** \brief Nodes count. */ unsigned int m_size; /** \brief Nodes. */ avl_node_ptr m_tree; }; // class avl_base } // namespace claw #include #endif // __CLAW_AVL_HPP__ libclaw-1.7.4/claw/basic_singleton.hpp000066400000000000000000000032301216507631600177470ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file basic_singleton.hpp * \brief A (really) basic implementation of the singleton design pattern. * \author Julien Jorge */ #ifndef __CLAW_BASIC_SINGLETON_HPP__ #define __CLAW_BASIC_SINGLETON_HPP__ #include namespace claw { namespace pattern { /** * \brief A (really) basic implementation of the singleton design pattern. * \author Julien Jorge */ template class basic_singleton: public non_copyable { public: static T& get_instance(); protected: basic_singleton(); ~basic_singleton(); }; // basic_singleton } // namespace pattern } // namespace claw #include #endif // __CLAW_BASIC_SINGLETON_HPP__ libclaw-1.7.4/claw/basic_socket.hpp000066400000000000000000000033301216507631600172360ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file basic_socket.hpp * \brief Common interface for claw::net::basic_socketbuf and * claw::net::socket_server * \author Julien Jorge */ #ifndef __CLAW_BASIC_SOCKET_HPP__ #define __CLAW_BASIC_SOCKET_HPP__ #include #include namespace claw { namespace net { /** * \brief Common interface for claw::net::basic_socketbuf and * claw::net::socket_server * \author Julien Jorge */ class basic_socket { public: basic_socket(); basic_socket* open(); basic_socket* close(); bool is_open() const; protected: /** \brief File descriptor. */ socket_traits::descriptor m_descriptor; }; // class basic_socket } // namespace net } // namespace claw #endif // __CLAW_BASIC_SOCKET_HPP__ libclaw-1.7.4/claw/basic_socketbuf.hpp000066400000000000000000000072171216507631600177430ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file basic_socketbuf.hpp * \brief Socket buffer to be used with std::basic_socket_stream, for easy * socket reading and writing. * \author Julien Jorge */ #ifndef __CLAW_BASIC_SOCKETBUF_HPP__ #define __CLAW_BASIC_SOCKETBUF_HPP__ #include #include #include namespace claw { namespace net { /** * \brief Socket buffer to be used with std::basic_stream, for easy socket * reading and writing. * \author Julien Jorge */ template< typename CharT, typename Traits > class basic_socketbuf : private basic_socket, public std::basic_streambuf { public: /** \brief The type of the characters in the stream. */ typedef CharT char_type; /** \brief The traits carry some informations about the char_type. */ typedef Traits traits_type; /** \brief The type used to represent integers. */ typedef typename traits_type::int_type int_type; /** \brief The type used to represent a position in the stream. */ typedef typename traits_type::pos_type pos_type; /** \brief The type used to represent a delta in the positions. */ typedef typename traits_type::off_type off_type; /** \brief The type of this implementation. */ typedef basic_socketbuf self_type; public: basic_socketbuf( int read_limit = -1 ); virtual ~basic_socketbuf(); self_type* open( const std::string& addr, int port ); self_type* open( socket_traits::descriptor d ); self_type* close(); bool is_open() const; void set_read_time_limit( int read_limit ); protected: virtual int sync(); virtual int_type underflow(); virtual int_type overflow( int_type c = traits_type::eof() ); private: bool connect( const std::string& addr, int port ); void create_buffers(); void destroy_buffers(); bool buffered() const; private: /** \brief Number of second to wait before considering nothing will come in the socket. Negative values mean infinity. */ int m_read_limit; /** \brief Input buffer. */ char_type* m_input_buffer; /** \brief Size of the input buffer. */ size_t m_input_buffer_size; /** \brief Output buffer. */ char_type* m_output_buffer; /** \brief Size of the output buffer. */ size_t m_output_buffer_size; /** \brief Default size for the buffers. */ static const size_t s_buffer_size; }; // class basic_socketbuf } // namespace net } // namespace claw #include #endif // __CLAW_BASIC_SOCKETBUF_HPP__ libclaw-1.7.4/claw/binary_node.hpp000066400000000000000000000030231216507631600170750ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file binary_node.hpp * \brief Basic binary node. * \author Julien Jorge */ #ifndef __CLAW_BINARY_NODE_HPP__ #define __CLAW_BINARY_NODE_HPP__ namespace claw { /** * \brief Basic binary node. * \author Julien Jorge */ template< class U > class binary_node { public : /** \brief Left child. */ U* left; /** \brief Right child */ U* right; explicit binary_node(); explicit binary_node( const binary_node& that ); ~binary_node(); void clear(); }; // binary_node; } // namespace claw #include #endif // __CLAW_BINARY_NODE_HPP__ libclaw-1.7.4/claw/bit_istream.hpp000066400000000000000000000036041216507631600171130ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file bit_istream.hpp * \brief This class is made to help reading datas of custom bit length. * \author Julien Jorge */ #ifndef __CLAW_BIT_ISTREAM_HPP__ #define __CLAW_BIT_ISTREAM_HPP__ namespace claw { /** * \brief This class is made to help reading datas of custom bit length. * \author Julien Jorge */ template class bit_istream { private: /** \brief The type of the stream we will read. */ typedef Stream stream_type; public: bit_istream( stream_type& f ); void read( char* buf, unsigned int n ); operator bool() const; private: /** \brief The stream we're reading. */ stream_type& m_stream; /** \brief Some bits available for reading. */ unsigned char m_pending; /** \brief The number of valid bits in m_pending. */ unsigned char m_pending_length; }; // class bit_istream } // namespace claw #include #endif // __CLAW_BIT_ISTREAM_HPP__ libclaw-1.7.4/claw/bit_ostream.hpp000066400000000000000000000036041216507631600171210ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file bit_ostream.hpp * \brief This class is made to help writing datas of custom bit length. * \author Julien Jorge */ #ifndef __CLAW_BIT_OSTREAM_HPP__ #define __CLAW_BIT_OSTREAM_HPP__ namespace claw { /** * \brief This class is made to help writing datas of custom bit length. * \author Julien Jorge */ template class bit_ostream { private: /** \brief The type of the stream we will write. */ typedef Stream stream_type; public: bit_ostream( stream_type& f ); ~bit_ostream(); void write( const char* buf, unsigned int n ); private: /** \brief The stream we're reading. */ stream_type& m_stream; /** \brief Some bits available for writing. */ unsigned char m_pending; /** \brief The number of valid bits in m_pending. */ unsigned char m_pending_length; }; // class bit_ostream } // namespace claw #include #endif // __CLAW_BIT_OSTREAM_HPP__ libclaw-1.7.4/claw/bitmap.hpp000066400000000000000000000244071216507631600160710ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file bitmap.hpp * \brief A class for bitmap pictures. * \author Julien Jorge */ #ifndef __CLAW_BITMAP_HPP__ #define __CLAW_BITMAP_HPP__ #include #include #include #include #include #include namespace claw { namespace graphic { /** * \brief A class for bitmap images. * \author Julien Jorge */ class bitmap : public image { private: /** * \brief Tool class used for defining the structures of the datas stored * in a bitmap file. * \author Julien Jorge */ class file_structure { public: /** \brief The type of the color palette for low color image files. */ typedef color_palette color_palette_type; /** \brief Compression mode. */ enum compression { BMP_COMPRESSION_RGB = 0, BMP_COMPRESSION_RLE8 = 1, BMP_COMPRESSION_RLE4 = 2, BMP_COMPRESSION_BITFIELDS = 3 }; # pragma pack (push,2) /** * \brief Header of a bitmap file. */ struct header { /** \brief File identifier (must be 'BM'). */ char id[2]; /** \brief File's size. */ unsigned int file_size; /** \brief not used. */ unsigned int nop; /** \brief Begininf of the datas. */ unsigned int data_offset; /** \brief Header's size. */ unsigned int header_size; /** \brief Image's width. */ unsigned int width; /** \brief Image's height. */ unsigned int height; /** \brief Number of layers. */ unsigned short layers; /** \brief Bits per pixel. */ unsigned short bpp; /** \brief Compression algorithm. */ unsigned int compression; /** \brief Image's size (bytes). */ unsigned int image_size; /** \brief Horizontal resolution (pixels per meter). */ unsigned int ppm_x; /** \brief Vertical resolution (pixels per meter). */ unsigned int ppm_y; /** \brief Number of colors. */ unsigned int colors_count; /** \brief Number of important colors. */ unsigned int importants_colors; }; # pragma pack (pop) }; // class file_structure public: /*----------------------------------------------------------------------*/ /** * \brief This class read data from a bitmap file and store it in an * image. * \author Julien Jorge */ class reader : private file_structure { private: /** \brief The type of the input buffer associated with the file when decoding RLE files. */ typedef buffered_istream file_input_buffer; /** * \brief The output buffer for the RLE decoder. * * \b Template \b parameters * - Coded4bits, true is the RLE patterns are coded in four bits ; * otherwise the patterns are supposed to be on eight * bits. * * \author Julien Jorge */ template< bool Coded4bits > class rle_bitmap_output_buffer { public: rle_bitmap_output_buffer( const color_palette_type& palette, image& image ); void fill( unsigned int n, unsigned char pattern ); void copy( unsigned int n, file_input_buffer& buffer ); void next_line(); void delta_move(unsigned char x, unsigned char y); private: /** \brief Color palette. */ const color_palette_type& m_palette; /** \brief The image to fill. */ image& m_image; /** \brief Current column index in the bitmap. */ unsigned int m_x; /** \brief Current row index in the bitmap. */ unsigned int m_y; }; // class rle_bitmap_output_buffer /** * \brief RLE decoder for bitmap RLE format * * \b Template \b parameters : * - \a OutputBuffer The type of the output buffer. * * The \a OutputBuffer type must match the type requirements of the * template parameter OutputBuffer of the rle_decoder class, plus two * methods : * - next_line(), set the output position at the begining of the next * line. * - delta_move( unsigned char x, unsigned char y ), move the output * position \a x pixels right and \a y pixels down. * * \author Julien Jorge */ template< typename OutputBuffer > class rle_bitmap_decoder : public rle_decoder< char, file_input_buffer, OutputBuffer > { public: /** \brief Type of the output buffer. */ typedef OutputBuffer output_buffer_type; private: virtual void read_mode( file_input_buffer& input, output_buffer_type& output ); }; // class rle_bitmap_decoder /** \brief RLE decoder for 4 bpp bitmap images. */ typedef rle_bitmap_decoder< rle_bitmap_output_buffer > rle4_decoder; /** \brief RLE decoder for 8 bpp bitmap images. */ typedef rle_bitmap_decoder< rle_bitmap_output_buffer > rle8_decoder; /** * \brief Functor converting a 1bpp buffer to a 32bpp buffer. */ class pixel1_to_pixel32 { public: void operator()( scanline& dest, const char* src, const color_palette_type& palette ) const; }; // class pixel1_to_pixel32 /** * \brief Functor converting a 4bpp buffer to a 32bpp buffer. */ class pixel4_to_pixel32 { public: void operator()( scanline& dest, const char* src, const color_palette_type& palette ) const; }; // class pixel4_to_pixel32 /** * \brief Functor converting a 8bpp buffer to a 32bpp buffer. */ class pixel8_to_pixel32 { public: void operator()( scanline& dest, const char* src, const color_palette_type& palette ) const; }; // class pixel8_to_pixel32 /** * \brief Functor converting a 24bpp buffer to a 32bpp buffer. */ class pixel24_to_pixel32 { public: void operator()( scanline& dest, const char* src, const color_palette_type& palette ) const; }; // class pixel24_to_pixel32 public: reader( image& img ); reader( image& img, std::istream& f ); void load( std::istream& f ); private: void load_palette( const header& h, std::istream& f, color_palette_type& palette ) const; void load_1bpp( const header& h, std::istream& f ); void load_4bpp( const header& h, std::istream& f ); void load_8bpp( const header& h, std::istream& f ); void load_24bpp( const header& h, std::istream& f ); void load_4bpp_rle( const header& h, std::istream& f, const color_palette_type& palette ); void load_4bpp_rgb( const header& h, std::istream& f, const color_palette_type& palette ); void load_8bpp_rle( const header& h, std::istream& f, const color_palette_type& palette ); void load_8bpp_rgb( const header& h, std::istream& f, const color_palette_type& palette ); template void load_rgb_data( std::istream& f, unsigned int buffer_size, const color_palette_type& palette, const Convert& pixel_convert ); private: /** \brief The image in which we store the data we read. */ image& m_image; }; // class reader /*----------------------------------------------------------------------*/ /** * \brief This class write an image in a bitmap file. * \author Julien Jorge */ class writer : private file_structure { public: writer( const image& img ); writer( const image& img, std::ostream& f ); void save( std::ostream& f ) const; private: void save_data( std::ostream& f ) const; void pixel32_to_pixel24( char* dest, const scanline& src ) const; void init_header( header& h ) const; private: /** \brief The image from which we read the data. */ const image& m_image; }; // class writer public: bitmap( unsigned int w, unsigned int h ); bitmap( const image& that ); bitmap( std::istream& f ); void save( std::ostream& f ) const; }; // class bitmap } // namespace graphic } // namespace claw #include #endif // __CLAW_BITMAP_HPP__ libclaw-1.7.4/claw/box_2d.hpp000066400000000000000000000102521216507631600157630ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file box_2d.hpp * \brief A rectangle represented by two points in a 2D space. * \author Julien Jorge */ #ifndef __CLAW_BOX_2D_HPP__ #define __CLAW_BOX_2D_HPP__ #include namespace claw { namespace math { template class rectangle; /** * \brief A rectangle represented by two points in a 2D space. * \author Julien Jorge */ template class box_2d { public: /** \brief The type of the values we store. */ typedef T value_type; /** \brief The type of the coordinates of the points representing the corners. */ typedef coordinate_2d point_type; /** \brief The type of the current class. */ typedef box_2d self_type; public: box_2d(); box_2d( const self_type& that ); box_2d( const rectangle& that ); box_2d( const point_type& p1, const point_type& p2 ); box_2d( const value_type& x1, const value_type& y1, const value_type& x2, const value_type& y2 ); void set( const value_type& x1, const value_type& y1, const value_type& x2, const value_type& y2 ); template box_2d cast_value_type_to() const; value_type area() const; bool includes( const coordinate_2d& p ) const; bool includes( const self_type& r ) const; bool intersects( const self_type& r ) const; self_type intersection( const self_type& r ) const; self_type join( const self_type& r ) const; bool empty() const; value_type top() const; value_type bottom() const; value_type left() const; value_type right() const; point_type top_left() const; point_type top_right() const; point_type bottom_left() const; point_type bottom_right() const; void top( const value_type& p ); void bottom( const value_type& p ); void left( const value_type& p ); void right( const value_type& p ); void top_left( const coordinate_2d& p ); void top_right( const coordinate_2d& p ); void bottom_left( const coordinate_2d& p ); void bottom_right( const coordinate_2d& p ); void shift_x( const value_type& d ); void shift_y( const value_type& d ); value_type width() const; value_type height() const; coordinate_2d size() const; bool operator==(const self_type& vect) const; bool operator!=(const self_type& vect) const; self_type operator+(const point_type& vect) const; self_type operator-(const point_type& vect) const; self_type& operator+=(const point_type& vect); self_type& operator-=(const point_type& vect); private: void x_intersection( const self_type& r, self_type& result ) const; void y_intersection( const self_type& r, self_type& result ) const; public: /** \brief The first of the two points, representing one corner. */ point_type first_point; /** \brief The second of the two points, representing an other corner. */ point_type second_point; }; // class box_2d } // namespace math } // namespace claw #include #endif // __CLAW_BOX_2D_HPP__ libclaw-1.7.4/claw/buffered_istream.hpp000066400000000000000000000045161216507631600201220ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file buffered_istream.hpp * \brief This class is made to help reading istreams with a buffer. * \author Julien Jorge */ #ifndef __CLAW_BUFFERED_ISTREAM_HPP__ #define __CLAW_BUFFERED_ISTREAM_HPP__ #include namespace claw { /** * \brief This class is made to help reading istreams with a buffer. * \author Julien Jorge */ template< typename Stream > class buffered_istream { private: /** \brief The type of the stream we will read. */ typedef Stream stream_type; public: buffered_istream( stream_type& f ); ~buffered_istream(); unsigned int remaining() const; bool read_more( unsigned int n ); const char* get_buffer() const; char get_next(); bool read( char* buf, unsigned int n ); void move( unsigned int n ); void close(); operator bool() const; private: /** \brief The stream we're reading. */ stream_type& m_stream; /** \brief Pointer to the begining of the buffer. */ char* m_begin; /** \brief Pointer to the first invalid byte after the end of the buffer. */ char* m_end; /** \brief Pointer to the current not already read valid byte. */ char* m_current; /** \brief The size of the allocated buffer. */ unsigned int m_buffer_size; }; // class buffered_istream } // namespace claw #include #endif // __CLAW_BUFFERED_ISTREAM_HPP__ libclaw-1.7.4/claw/buffered_ostream.hpp000066400000000000000000000042021216507631600201200ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file buffered_ostream.hpp * \brief This class is made to help wrinting in ostreams with a buffer. * \author Julien Jorge */ #ifndef __CLAW_BUFFERED_OSTREAM_HPP__ #define __CLAW_BUFFERED_OSTREAM_HPP__ namespace claw { /** * \brief This class is made to help writing in ostreams with a buffer. * \author Julien Jorge */ template< typename Stream > class buffered_ostream { private: /** \brief The type of the stream we will write. */ typedef Stream stream_type; public: buffered_ostream( stream_type& f, unsigned int buffer_size = 1024 ); ~buffered_ostream(); template void write(T v); void write(const char* p, unsigned int n); void flush(); private: /** \brief The stream we're writing. */ stream_type& m_stream; /** \brief Pointer to the begining of the buffer. */ char* const m_begin; /** \brief Pointer to the first invalid byte after the end of the buffer. */ char* const m_end; /** \brief Pointer to the current not already read valid byte. */ char* m_current; }; // class buffered_ostream } // namespace claw #include #endif // __CLAW_BUFFERED_OSTREAM_HPP__ libclaw-1.7.4/claw/claw.hpp000066400000000000000000000044441216507631600155420ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw.hpp * \brief The purpose of this file is to document the namespaces of the library. * \author Julien Jorge */ /** * \brief This is the main namespace. */ namespace claw { /** * \brief Everything about artificial intelligence. */ namespace ai { /** * \brief Everything about artificial intelligence related game algorithms. */ namespace game { } // namespace game } // namespace ai /** * \brief Here are the design patterns. */ namespace pattern { } // namespace pattern /** * \brief Everything about image structures and processing. */ namespace graphic { } // namespace image /** * \brief Manipulation of mathematic, geometric, etc. items. */ namespace math { } // namespace math /** * \brief Memory management. */ namespace memory { } // namespace memory /** * \brief Structures for meta-programmation. */ namespace meta { } // namespace meta /** * \brief Network communications. */ namespace net { } // namespace net /** * \brief Everything about text processing. */ namespace text { } // namespace text /** * \brief Tweeners interpolate the intermediate values between two given * reference values using various equations. * \sa \ref tweeners */ namespace tween { } // namespace tween } // namespace claw libclaw-1.7.4/claw/claw_gettext.hpp000066400000000000000000000031401216507631600172760ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw_gettext.hpp * \brief Macros to call gettext on the libclaw textdomain. * \author Julien Jorge */ #ifndef __CLAW_CLAW_GETTEXT_HPP__ #define __CLAW_CLAW_GETTEXT_HPP__ #include /** * \brief Call gettext on the default text domain used by Claw. * \param s The string to translate. */ #define claw_gettext(s) dgettext( "libclaw", (s) ) /** * \brief Call ngettext on the default text domain used by Claw. * \param s The string to translate by default. * \param p The plural version of s. * \param n The number thar triggers the choice of \a s or \a p. */ #define claw_ngettext(s, p, n) dngettext( "libclaw", (s), (p), (n) ) #endif // __CLAW_CLAW_GETTEXT_HPP__ libclaw-1.7.4/claw/code/000077500000000000000000000000001216507631600150075ustar00rootroot00000000000000libclaw-1.7.4/claw/code/application.cpp000066400000000000000000000101731216507631600200200ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file application.cpp * \brief Implementation of the claw::application class. * \author Julien Jorge */ #include #include #include #include #include /** * \brief Build a char[] string representing an expression. * \param e The content of the string. */ #define CLAW_MK_STR_(e) #e /** * \brief Build a char[] string representing an expression. * \param e The content of the string. */ #define CLAW_MK_STR(e) CLAW_MK_STR_(e) /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param argc Number of arguments to the program. * \param argv The arguments of the program. * * The constructor removes from argv all supported arguments, and updates the * value of argc. */ claw::application::application( int& argc, char** &argv ) : m_arguments( argc, argv ) { setlocale( LC_ALL, "" ); #ifdef CLAW_TEXT_DOMAIN_PATH bindtextdomain( "libclaw", CLAW_MK_STR(CLAW_TEXT_DOMAIN_PATH) ); #endif bind_textdomain_codeset( "libclaw", "UTF-8" ); textdomain("libclaw"); m_arguments.add_long ("--log-file", claw_gettext("The file to use to store log informations."), true, claw_gettext("file") ); m_arguments.add_long ("--log-level", claw_gettext("Level of log informations:\n" "\t\terror: error messages,\n" "\t\twarning: warning and error messages,\n" "\t\tverbose: all messages."), true, claw_gettext("string") ); m_arguments.add_long ("--log-uniq", claw_gettext ("Use a logger that does not output successively the same message."), true ); m_arguments.add_long ("--log-concise", claw_gettext ("Use a logger that does not output messages that have been recently" " output."), true, claw_gettext("integer") ); m_arguments.parse( argc, argv ); log_stream* log; if ( m_arguments.has_value("--log-file") ) log = new file_logger( m_arguments.get_string("--log-file") ); else log = new console_logger; if ( m_arguments.get_bool("--log-uniq") ) log = new log_stream_uniq(log); else if ( m_arguments.has_value("--log-concise") && m_arguments.only_integer_values("--log-concise") && m_arguments.get_integer("--log-concise") > 0 ) log = new log_stream_concise(log, m_arguments.get_integer("--log-concise")); else if ( m_arguments.get_bool("--log-concise") ) log = new log_stream_concise(log); logger.set( log ); if ( m_arguments.has_value( "--log-level" ) ) { std::string level = m_arguments.get_string("--log-level"); if ( (level == "error") || (level == claw_gettext("error")) ) logger.set_level( log_error ); else if ( (level == "warning") || (level == claw_gettext("warning")) ) logger.set_level( log_warning ); else if ( (level == "verbose") || (level == claw_gettext("verbose")) ) logger.set_level( log_verbose ); else logger.set_level( m_arguments.get_integer("--log-level") ); } } // application::application() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ claw::application::~application() { logger.clear(); } // application::~application() libclaw-1.7.4/claw/code/arguments.cpp000066400000000000000000000357171216507631600175350ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file arguments.cpp * \brief Implementation of the claw::arguments class. * \author Julien Jorge */ #include #include #include #include #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ claw::arguments::arguments() : m_program_name( claw_gettext("") ) { } // arguments::arguments() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param prog_name Force the name of the program. */ claw::arguments::arguments( const std::string& prog_name ) : m_program_name(prog_name) { } // arguments::arguments() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param argc Number of arguments. * \param argv Arguments. * * You should construct an instance with the parameters given to your function * main(). The constructor will remove all supported arguments from argv. */ claw::arguments::arguments( int& argc, char** &argv ) { parse(argc, argv); } // arguments::arguments() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param argc Number of arguments. * \param argv Arguments. * \param allowed The set of allowed arguments. * * You should construct an instance with the parameters given to your function * main(). The constructor will remove all supported arguments from argv. */ claw::arguments::arguments(int& argc, char** &argv, const claw::math::ordered_set& allowed ) { parse(argc, argv, allowed); } // arguments::arguments() /*----------------------------------------------------------------------------*/ /** * \brief Parse arguments. * \param argc Number of arguments. * \param argv Arguments. * * All supported arguments will be removed from argv. */ void claw::arguments::parse( int& argc, char** &argv ) { parse( argc, argv, true, claw::math::ordered_set() ); } // arguments::parse() /*----------------------------------------------------------------------------*/ /** * \brief Parse arguments. * \param argc Number of arguments. * \param argv Arguments. * \param allowed The set of allowed arguments. * * All supported arguments will be removed from argv. */ void claw::arguments::parse ( int& argc, char** &argv, const claw::math::ordered_set& allowed ) { parse( argc, argv, false, allowed ); } // arguments::parse() /*----------------------------------------------------------------------------*/ /** * \brief Tell if a value is associated to an argument. * \param arg_name The name of the argument to test. */ bool claw::arguments::has_value( const std::string& arg_name ) const { return m_pairs.find( arg_name ) != m_pairs.end(); } // arguments::has_value() /*----------------------------------------------------------------------------*/ /** * \brief Tell if only integer values are associated to an argument. * \param arg_name The name of the argument to test. */ bool claw::arguments::only_integer_values( const std::string& arg_name ) const { const valued_arguments_map::const_iterator itk(m_pairs.find(arg_name)); bool result = true; if ( itk == m_pairs.end() ) result = false; else { std::list::const_iterator it; for( it=itk->second.begin(); result && (it!=itk->second.end()); ++it ) result = result && text::is_of_type(*it); } return result; } // arguments::only_integer_values() /*----------------------------------------------------------------------------*/ /** * \brief Tell if only real values are associated to an argument. * \param arg_name The name of the argument to test. */ bool claw::arguments::only_real_values( const std::string& arg_name ) const { const valued_arguments_map::const_iterator itk(m_pairs.find(arg_name)); bool result = true; if ( itk == m_pairs.end() ) result = false; else { std::list::const_iterator it; for( it=itk->second.begin(); result && (it!=itk->second.end()); ++it ) result = result && text::is_of_type(*it); } return result; } // arguments::only_real_values() /*----------------------------------------------------------------------------*/ /** * \brief Get the name of the program. */ const std::string& claw::arguments::get_program_name() const { return m_program_name; } // arguments::get_program_name() /*----------------------------------------------------------------------------*/ /** * \brief Get the boolean state of an argument. * \param arg_name The name of the argument to get. */ bool claw::arguments::get_bool( const std::string& arg_name ) const { return m_flags.find( arg_name ) != m_flags.end(); } // arguments::get_bool() /*----------------------------------------------------------------------------*/ /** * \brief Get the integer value of an argument. * \param arg_name The name of the argument to get. * \pre has_value(arg_name) */ int claw::arguments::get_integer( const std::string& arg_name ) const { CLAW_ASSERT( has_value(arg_name), "arguments::get_integer(): argument is not set." ); std::istringstream iss( m_pairs.find( arg_name )->second.back() ); int val; iss >> val; return val; } // arguments::get_integer() /*----------------------------------------------------------------------------*/ /** * \brief Get the real value of an argument. * \param arg_name The name of the argument to get. * \pre has_value(arg_name) */ double claw::arguments::get_real( const std::string& arg_name ) const { CLAW_ASSERT( has_value(arg_name), "arguments::get_real(): argument is not set." ); std::istringstream iss( m_pairs.find( arg_name )->second.back() ); double val; iss >> val; return val; } // arguments::get_real() /*----------------------------------------------------------------------------*/ /** * \brief Get the string value of an argument. * \param arg_name The name of the argument to get. * \pre has_value(arg_name) */ const std::string& claw::arguments::get_string( const std::string& arg_name ) const { CLAW_ASSERT( has_value(arg_name), "arguments::get_string(): argument is not set." ); return m_pairs.find( arg_name )->second.back(); } // arguments::get_string() /*----------------------------------------------------------------------------*/ /** * \brief Get all integer values of an argument. * \param arg_name The name of the argument to get. */ std::list claw::arguments::get_all_of_integer( const std::string& arg_name ) const { std::list result; const valued_arguments_map::const_iterator itk(m_pairs.find(arg_name)); if ( itk != m_pairs.end() ) { std::list::const_iterator it; for( it=itk->second.begin(); it!=itk->second.end(); ++it ) if ( text::is_of_type(*it) ) { std::istringstream iss(*it); int val; iss >> val; result.push_back(val); } } return result; } // arguments::get_all_of_integer() /*----------------------------------------------------------------------------*/ /** * \brief Get all real values of an argument. * \param arg_name The name of the argument to get. */ std::list claw::arguments::get_all_of_real( const std::string& arg_name ) const { std::list result; const valued_arguments_map::const_iterator itk(m_pairs.find(arg_name)); if ( itk != m_pairs.end() ) { std::list::const_iterator it; for( it=itk->second.begin(); it!=itk->second.end(); ++it ) if ( text::is_of_type(*it) ) { std::istringstream iss(*it); double val; iss >> val; result.push_back(val); } } return result; } // arguments::get_all_of_real() /*----------------------------------------------------------------------------*/ /** * \brief Get all string values of an argument. * \param arg_name The name of the argument to get. */ std::list claw::arguments::get_all_of_string( const std::string& arg_name ) const { std::list result; const valued_arguments_map::const_iterator itk(m_pairs.find(arg_name)); if ( itk != m_pairs.end() ) result = itk->second; return result; } // arguments::get_all_of_string() /*----------------------------------------------------------------------------*/ /** * \brief Add an argument in our list. * * You can use this method to set default values to the parameters of your * program, before calling parse_arguments. * * \param arg The argument to add. * \pre (arg != "--") && (arg[0] == '-') */ void claw::arguments::add_argument( const std::string& arg ) { CLAW_ASSERT( arg != "--", "arguments::add_argument(): arg can't be '--'" ); CLAW_ASSERT( arg[0] == '-', "arguments::add_argument(): arg must begin by '-'" ); std::string name, value; const bool has_value = split_argument(arg, name, value); if ( !has_value ) m_flags.insert( arg ); else m_pairs[name].push_back(value); } // arguments::add_argument() /*----------------------------------------------------------------------------*/ /** * \brief Parse arguments. * \param argc Number of arguments. * \param argv Arguments. * \param always_allowed If true, \a allowed is never used and all arguments * with a valid format are accepted. * \param allowed The set of allowed arguments. * \return true if the argument has a value associated with him. * * All supported arguments will be removed from argv. */ void claw::arguments::parse ( int& argc, char** &argv, bool always_allowed, const claw::math::ordered_set& allowed ) { bool stop = false; int base = 0; if (m_program_name.empty() && (argc!=0)) { m_program_name = argv[0]; argv[0] = NULL; base = 1; } for (int argi=base; (argi!=argc) && !stop; ++argi) { std::string arg(argv[argi]); if ( !arg.empty() ) if ( (arg[0] == '-') && (arg.length() > 1) ) { if (arg == "--") stop = true; else { std::string name, value; const bool has_value = split_argument( arg, name, value ); if ( !has_value ) process_boolean( argv[argi], always_allowed, allowed ); else if ( always_allowed || (allowed.find( name ) != allowed.end()) ) { add_argument( arg ); argv[argi] = NULL; } } } } remove_null_arguments( argc, argv ); } // arguments::parse() /*----------------------------------------------------------------------------*/ /** * \brief Split an argument to get its name and its value. * \param arg The argument to split. * \param name (out) The name of the argument. * \param value (out) The value of the argument. * \return true if the argument has a value associated with him. * \pre (arg != "--") && (arg[0] == '-') */ bool claw::arguments::split_argument ( const std::string& arg, std::string& name, std::string& value ) const { CLAW_ASSERT( arg != "--", "arguments::split_argument(): arg can't be '--'" ); CLAW_ASSERT( arg[0] == '-', "arguments::split_argument(): arg must begin by '-'" ); std::string::size_type pos = arg.find_first_of('='); bool result(false); if ( pos == std::string::npos ) { name = arg; value.clear(); } else { name = arg.substr(0, pos); value = arg.substr(pos+1, arg.length() - pos - 1); result = true; } return result; } // arguments::split_argument() /*----------------------------------------------------------------------------*/ /** * \brief Remove all NULL arguments from argv and update argc. * \param argc The number of arguments. * \param argv The arguments. */ void claw::arguments::remove_null_arguments( int& argc, char** &argv ) const { unsigned int c=0; // number of non-NULL arguments for (int i=0; i!=argc; ++i) if ( argv[i] != NULL ) ++c; else { bool ok = false; int j=i; while ( (j!=argc) && !ok ) if ( argv[j] == NULL ) ++j; else ok = true; if (ok) { argv[i] = argv[j]; argv[j] = NULL; ++c; } } if ( c > 0 ) if ( (std::string(argv[c-1]) == "--") ) --c; argc=c; } // arguments::remove_null_arguments() /*----------------------------------------------------------------------------*/ /** * \brief Process a boolean option. * \param arg (in) The argument to process, (out) the argument cleaned of all * valid values. * \param always_allowed If true, \a allowed is never used and all arguments * with a valid format are accepted. * \param allowed The set of allowed arguments. * */ void claw::arguments::process_boolean ( char* &arg, bool always_allowed, const claw::math::ordered_set& allowed ) { CLAW_ASSERT( std::string(arg) != "--", "arg can't be '--'" ); CLAW_ASSERT( std::string(arg).length() > 1, "arg must be at least two characters long" ); CLAW_ASSERT( arg[0] == '-', "arg must begin by '-'" ); if ( arg[1] == '-' ) // long boolean { if ( always_allowed || (allowed.find(arg) != allowed.end()) ) { add_argument(arg); arg = NULL; } } else // short boolean(s) { int i(1); std::string s("-?"); // equivalent single character argument while ( arg[i] != '\0' ) { s[1] = arg[i]; if ( always_allowed || (allowed.find(s) != allowed.end()) ) { add_argument(s); // shift remaining arguments for ( int j=i; arg[j]!='\0'; ++j ) arg[j] = arg[j+1]; } else ++i; } if ( i==1 ) // all arguments have been accepted arg = NULL; } } // arguments::process_boolean() libclaw-1.7.4/claw/code/arguments_table.cpp000066400000000000000000000455321216507631600207000ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file arguments_table.cpp * \brief Implementation of the claw::arguments_table class. * \author Julien Jorge */ #include #include #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param name The principal name of the argument. * \param second_name The second name of the argument. * \param help_message Message describing the role of the argument. * \param optional Tell if this argument is optional. * \param value_type The kind of value needed for this argument. */ claw::arguments_table::argument_attributes::argument_attributes ( const std::string& name, const std::string& second_name, const std::string& help_message, bool optional, const std::string& value_type ) : m_name(name), m_second_name(second_name), m_help_message(help_message), m_optional(optional), m_value_type(value_type) { } // arguments_table::argument_attributes::argument_attributes() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the principal name of this argument is alphabetically less * than the name of an other argument. */ bool claw::arguments_table::argument_attributes::operator< ( const argument_attributes& that ) const { return m_name < that.m_name; } // arguments_table::argument_attributes::operator<() /*----------------------------------------------------------------------------*/ /** * \brief Get a short description of the arguement. */ std::string claw::arguments_table::argument_attributes::format_short_help() const { std::string result(m_name); if (!m_value_type.empty()) result += "=" + m_value_type; if (m_optional) return "[" + result + "]"; else return result; } // arguments_table::argument_attributes::format_short_help() /*----------------------------------------------------------------------------*/ /** * \brief Get a long description of the argument. */ std::string claw::arguments_table::argument_attributes::format_long_help() const { std::string result(m_name); if ( !m_second_name.empty() ) result += ", " + m_second_name; return result + "\t" + m_help_message; } // arguments_table::argument_attributes::format_long_help() /*----------------------------------------------------------------------------*/ /** * \brief Get the principal name of the argument. */ const std::string& claw::arguments_table::argument_attributes::get_name() const { return m_name; } // arguments_table::argument_attributes::get_name() /*----------------------------------------------------------------------------*/ /** * \brief Get the second name of the argument. */ const std::string& claw::arguments_table::argument_attributes::get_second_name() const { return m_second_name; } // arguments_table::argument_attributes::get_second_name() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the argument is optional. */ bool claw::arguments_table::argument_attributes::is_optional() const { return m_optional; } // arguments_table::argument_attributes::is_optional() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param prog_name Force the name of the program. */ claw::arguments_table::arguments_table( const std::string& prog_name ) : m_arguments(prog_name) { } // arguments_table::arguments_table() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param argc Number of arguments. * \param argv Arguments. * * All supported arguments will be removed from argv. */ claw::arguments_table::arguments_table( int& argc, char** &argv ) : m_arguments(argc, argv, claw::math::ordered_set() ) { } // arguments_table::arguments_table() /*----------------------------------------------------------------------------*/ /** * \brief Add an argument in the table. * \param short_name The short name of the argument. * \param long_name The long name of the argument. * \param help_msg A description of the argument. * \param optional Tell if the argument is optional. * \param val_name The type of the value needed for this argument. */ void claw::arguments_table::add( const std::string& short_name, const std::string& long_name, const std::string& help_msg, bool optional, const std::string& val_name ) { m_short_arguments.insert( argument_attributes(short_name, long_name, help_msg, optional, val_name) ); m_long_arguments.insert( argument_attributes(long_name, short_name, help_msg, optional, val_name) ); } // arguments_table::add() /*----------------------------------------------------------------------------*/ /** * \brief Add an argument in the table. * \param long_name The long name of the argument. * \param help_msg A description of the argument. * \param optional Tell if the argument is optional. * \param val_name The type of the value needed for this argument. */ void claw::arguments_table::add_long( const std::string& long_name, const std::string& help_msg, bool optional, const std::string& val_name ) { m_long_arguments.insert( argument_attributes(long_name, "", help_msg, optional, val_name) ); } // arguments_table::add_long() /*----------------------------------------------------------------------------*/ /** * \brief Add an argument in the table. * \param short_name The short name of the argument. * \param help_msg A description of the argument. * \param optional Tell if the argument is optional. * \param val_name The type of the value needed for this argument. */ void claw::arguments_table::add_short( const std::string& short_name, const std::string& help_msg, bool optional, const std::string& val_name ) { m_short_arguments.insert( argument_attributes(short_name, "", help_msg, optional, val_name) ); } // arguments_table::add_short() /*----------------------------------------------------------------------------*/ /** * \brief Parse the command line arguments. * \param argc Number of arguments. * \param argv Arguments. * * All supported arguments will be removed from argv. */ void claw::arguments_table::parse( int& argc, char** &argv ) { math::ordered_set allowed; math::ordered_set::const_iterator it; for (it=m_short_arguments.begin(); it!=m_short_arguments.end(); ++it) allowed.insert(it->get_name()); for (it=m_long_arguments.begin(); it!=m_long_arguments.end(); ++it) allowed.insert(it->get_name()); m_arguments.parse( argc, argv, allowed ); } // arguments_table::parse() /*----------------------------------------------------------------------------*/ /** * \brief Print some help about the arguments. * \param free_args The arguments of your program that are not managed by * claw::arguments_table. * * The method prints the name of the program, required arguments, optional * arguments and, then, \a free_args. Arguments are printed in short format when * available. A line is then skipped and the long description of the arguments * is printed. */ void claw::arguments_table::help( const std::string& free_args ) const { std::cout << m_arguments.get_program_name(); typedef math::ordered_set::const_iterator set_iterator; std::list optional; std::list::const_iterator it_opt; set_iterator it; for (it=m_short_arguments.begin(); it!=m_short_arguments.end(); ++it) if ( it->is_optional() ) optional.push_back(it); else std::cout << ' ' << it->format_short_help(); for (it=m_long_arguments.begin(); it!=m_long_arguments.end(); ++it) if (it->get_second_name().empty()) { if ( it->is_optional() ) optional.push_back(it); else std::cout << ' ' << it->format_short_help(); } for (it_opt=optional.begin(); it_opt!=optional.end(); ++it_opt) std::cout << ' ' << (*it_opt)->format_short_help(); if ( !free_args.empty() ) std::cout << ' ' << free_args; std::cout << "\n\n"; for (it=m_short_arguments.begin(); it!=m_short_arguments.end(); ++it) std::cout << "\t" << it->format_long_help() << std::endl; for (it=m_long_arguments.begin(); it!=m_long_arguments.end(); ++it) if (it->get_second_name().empty()) std::cout << "\t" << it->format_long_help() << std::endl; } // arguments_table::help() /*----------------------------------------------------------------------------*/ /** * \brief Tell if all arguments not marqued as "optional" have been specified in * the command line. * * \remark The method doesn't check the value of the arguments. If, for example, * an argument needs to be an integer and the user use it as a boolean, * the method will return true. */ bool claw::arguments_table::required_fields_are_set() const { bool ok = true; math::ordered_set::const_iterator it; for (it=m_short_arguments.begin(); (it!=m_short_arguments.end()) && ok; ++it) if ( !it->is_optional() ) ok = ok && has_value(it->get_name()); for (it=m_long_arguments.begin(); (it!=m_long_arguments.end()) && ok; ++it) if ( !it->is_optional() ) ok = ok && has_value(it->get_name()); return ok; } // arguments_table::required_fields_are_set() /*----------------------------------------------------------------------------*/ /** * \brief Tell if an argument has a value. * \param arg_name The name of the argument to find. */ bool claw::arguments_table::has_value( const std::string& arg_name ) const { bool result = false; std::string short_name, long_name; get_argument_names( arg_name, short_name, long_name ); if ( !short_name.empty() ) result = m_arguments.has_value(short_name); if (!result) if ( !long_name.empty() ) result = m_arguments.has_value(long_name); return result; } // arguments_table::has_value() /*----------------------------------------------------------------------------*/ /** * \brief Tell if only integer values are associated to an argument. * \param arg_name The name of the argument to test. */ bool claw::arguments_table::only_integer_values( const std::string& arg_name ) const { bool result = true; std::string short_name, long_name; get_argument_names( arg_name, short_name, long_name ); if ( short_name.empty() && long_name.empty() ) result = false; else { if ( !short_name.empty() ) result = m_arguments.only_integer_values(short_name); if ( !long_name.empty() ) result = result && m_arguments.only_integer_values(long_name); } return result; } // arguments_table::only_integer_values() /*----------------------------------------------------------------------------*/ /** * \brief Tell if only real values are associated to an argument. * \param arg_name The name of the argument to test. */ bool claw::arguments_table::only_real_values( const std::string& arg_name ) const { bool result = true; std::string short_name, long_name; get_argument_names( arg_name, short_name, long_name ); if ( short_name.empty() && long_name.empty() ) result = false; else { if ( !short_name.empty() ) result = m_arguments.only_real_values(short_name); if ( !long_name.empty() ) result = result && m_arguments.only_real_values(long_name); } return result; } // arguments_table::only_real_values() /*----------------------------------------------------------------------------*/ /** * \brief Get the name of the program. */ const std::string& claw::arguments_table::get_program_name() const { return m_arguments.get_program_name(); } // arguments_table::has_value() /*----------------------------------------------------------------------------*/ /** * \brief Get the boolean state of an argument. * \param arg_name The name of the argument to find. */ bool claw::arguments_table::get_bool( const std::string& arg_name ) const { std::string short_name, long_name; get_argument_names( arg_name, short_name, long_name ); return m_arguments.get_bool(short_name) || m_arguments.get_bool(long_name); } // arguments_table::get_bool() /*----------------------------------------------------------------------------*/ /** * \brief Get the integer value of an argument. * \param arg_name The name of the argument to find. * \pre has_value(arg_name) */ int claw::arguments_table::get_integer( const std::string& arg_name ) const { CLAW_PRECOND( has_value(arg_name) ); std::string short_name, long_name; get_argument_names( arg_name, short_name, long_name ); if ( m_arguments.has_value(short_name) ) return m_arguments.get_integer(short_name); else return m_arguments.get_integer(long_name); } // arguments_table::get_integer() /*----------------------------------------------------------------------------*/ /** * \brief Get the real value of an argument. * \param arg_name The name of the argument to find. * \pre has_value(arg_name) */ double claw::arguments_table::get_real( const std::string& arg_name ) const { CLAW_PRECOND( has_value(arg_name) ); std::string short_name, long_name; get_argument_names( arg_name, short_name, long_name ); if ( m_arguments.has_value(short_name) ) return m_arguments.get_real(short_name); else return m_arguments.get_real(long_name); } // arguments_table::get_real() /*----------------------------------------------------------------------------*/ /** * \brief Get the string value of an argument. * \param arg_name The name of the argument to find. * \pre has_value(arg_name) */ const std::string& claw::arguments_table::get_string( const std::string& arg_name ) const { CLAW_PRECOND( has_value(arg_name) ); std::string short_name, long_name; get_argument_names( arg_name, short_name, long_name ); if ( m_arguments.has_value(short_name) ) return m_arguments.get_string(short_name); else return m_arguments.get_string(long_name); } // arguments_table::get_string() /*----------------------------------------------------------------------------*/ /** * \brief Get all integer values of an argument. * \param arg_name The name of the argument to get. */ std::list claw::arguments_table::get_all_of_integer( const std::string& arg_name ) const { std::list result; std::string short_name, long_name; get_argument_names( arg_name, short_name, long_name ); if ( !short_name.empty() ) result = m_arguments.get_all_of_integer(short_name); if ( !long_name.empty() ) { const std::list p(m_arguments.get_all_of_integer(long_name)); result.insert( result.end(), p.begin(), p.end() ); } return result; } // arguments_table::get_all_of_integer() /*----------------------------------------------------------------------------*/ /** * \brief Get all real values of an argument. * \param arg_name The name of the argument to get. */ std::list claw::arguments_table::get_all_of_real( const std::string& arg_name ) const { std::list result; std::string short_name, long_name; get_argument_names( arg_name, short_name, long_name ); if ( !short_name.empty() ) result = m_arguments.get_all_of_real(short_name); if ( !long_name.empty() ) { const std::list p(m_arguments.get_all_of_real(long_name)); result.insert( result.end(), p.begin(), p.end() ); } return result; } // arguments_table::get_all_of_real() /*----------------------------------------------------------------------------*/ /** * \brief Get all string values of an argument. * \param arg_name The name of the argument to get. */ std::list claw::arguments_table::get_all_of_string( const std::string& arg_name ) const { std::list result; std::string short_name, long_name; get_argument_names( arg_name, short_name, long_name ); if ( !short_name.empty() ) result = m_arguments.get_all_of_string(short_name); if ( !long_name.empty() ) { const std::list p(m_arguments.get_all_of_string(long_name)); result.insert( result.end(), p.begin(), p.end() ); } return result; } // arguments_table::get_all_of_string() /*----------------------------------------------------------------------------*/ /** * \brief Add an argument in our list. * * You can use this method to set default values to the parameters of your * program, before calling parse. * * \param arg The argument to add. * \pre (arg != "--") && (arg[0] == '-') */ void claw::arguments_table::add_argument( const std::string& arg ) { m_arguments.add_argument( arg ); } // arguments_table::add_argument() /*----------------------------------------------------------------------------*/ /** * \brief Get the principal name and the second name of an argument. * \param arg_name The name of the argument to find. * \param short_name The short name of the argument. * \param long_name The long name of the argument. */ void claw::arguments_table::get_argument_names ( const std::string& arg_name, std::string& short_name, std::string& long_name ) const { argument_attributes attr(arg_name, "", "", false, ""); math::ordered_set::const_iterator it; // if arg_name is short, try to find the long version it = m_short_arguments.find( attr ); if (it != m_short_arguments.end()) { short_name = arg_name; long_name = it->get_second_name(); } else { // if arg_name is long, try to find the short version it = m_long_arguments.find( attr ); if (it != m_long_arguments.end()) { short_name = it->get_second_name(); long_name = arg_name; } } } // arguments_table::get_argument_names() libclaw-1.7.4/claw/code/basic_socket.cpp000066400000000000000000000047341216507631600201540ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file basic_socket.cpp * \brief Implementation of the claw::net::basic_socket class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \post is_open() == false */ claw::net::basic_socket::basic_socket() : m_descriptor(socket_traits::invalid_socket) { } // basic_socket::basic_socket() /*----------------------------------------------------------------------------*/ /** * \brief Open the socket. * \return this is everything works fine, NULL otherwise. */ claw::net::basic_socket* claw::net::basic_socket::open() { basic_socket* result = NULL; m_descriptor = socket_traits::open(); if ( socket_traits::valid_descriptor( m_descriptor ) ) result = this; return result; } // basic_socket::open() /*----------------------------------------------------------------------------*/ /** * \brief Close the socket. * \return this if everything works fine, NULL otherwise. */ claw::net::basic_socket* claw::net::basic_socket::close() { basic_socket* result = this; if ( is_open() ) { if ( socket_traits::close(m_descriptor) ) m_descriptor = socket_traits::invalid_socket; else result = NULL; } return result; } // basic_socket::close() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the socket is open. */ bool claw::net::basic_socket::is_open() const { return socket_traits::valid_descriptor(m_descriptor); } // basic_socket::is_open() libclaw-1.7.4/claw/code/bitmap.cpp000066400000000000000000000042721216507631600167740ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file bitmap.cpp * \brief Implementation of the bitmap class. * \author Julien Jorge */ #include /*---------------------------------------------------------------------------*/ /** * \brief Constructor. Creates an empty image. * \param w Image's width. * \param h Image's height. * \pre w > 0 and h > 0 */ claw::graphic::bitmap::bitmap( unsigned int w, unsigned int h ) : claw::graphic::image(w, h) { } // bitmap::bitmap() [constructor] /*---------------------------------------------------------------------------*/ /** * \brief Copy constructor. * \param that Image to copy from. */ claw::graphic::bitmap::bitmap( const image& that ) : claw::graphic::image(that) { } // bitmap::bitmap() [copy constructor] /*---------------------------------------------------------------------------*/ /** * \brief Constructor. Load an image from a bitmap file. * \param f Bitmap file. */ claw::graphic::bitmap::bitmap( std::istream& f ) { reader r(*this, f); } // bitmap::bitmap() [constructor, from file] /*---------------------------------------------------------------------------*/ /** * \brief Save the bitmap in a file. * \param f Destination file. */ void claw::graphic::bitmap::save( std::ostream& f ) const { writer w(*this, f); } // bitmap::save() libclaw-1.7.4/claw/code/bitmap_reader.cpp000066400000000000000000000424011216507631600203120ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file bitmap_reader.cpp * \brief Implementation of the claw::graphic::bitmap::reader class. * \author Julien Jorge */ #include #include namespace claw { namespace graphic { /*------------------------------------------------------------------------*/ /** * \brief Copy a color a certain number of times. * \param n Number of copies. * \param pattern The index of the color to copy. * \remark This method is for 8bpp bitmaps. */ template<> void bitmap::reader::rle_bitmap_output_buffer::fill ( unsigned int n, unsigned char pattern ) { assert( m_x + n <= m_image.width() ); std::fill(&m_image[m_y][m_x], &m_image[m_y][m_x] + n, m_palette[pattern]); m_x += n; } // bitmap::reader::rle_bitmap_output_buffer::fill() } // namespace graphic } // namespace claw namespace claw { namespace graphic { /*------------------------------------------------------------------------*/ /** * \brief Copy a pair of colors a certain number of times. * \param n Number of pixels to fill. * \param pattern The index of the two colors to copy. * \remark This method is for 4bpp bitmaps. */ template<> void bitmap::reader::rle_bitmap_output_buffer::fill ( unsigned int n, unsigned char pattern ) { assert( m_x + n <= m_image.width() ); for (unsigned int i = 0; i != n / 2; ++i, m_x += 2) { m_image[m_y][m_x] = m_palette[ (pattern & 0xF0) >> 4 ]; m_image[m_y][m_x+1] = m_palette[ pattern & 0x0F ]; } if ( n % 2 ) { m_image[m_y][m_x] = m_palette[ (pattern & 0xF0) >> 4 ]; ++m_x; } } // bitmap::reader::rle_bitmap_output_buffer::fill() } // namespace graphic } // namespace claw namespace claw { namespace graphic { /*------------------------------------------------------------------------*/ /** * \brief Copy some pixels directly. * \param n The number of pixels to copy. * \param buffer The input buffer, to copy from. * \remark This method is for 8bpp bitmaps. */ template<> void bitmap::reader::rle_bitmap_output_buffer::copy ( unsigned int n, file_input_buffer& buffer ) { assert( m_x + n <= m_image.width() ); // RLE bitmap data is 2-bytes aligned const unsigned int bytes_needed = n + n % 2; if ( buffer.remaining() < bytes_needed ) buffer.read_more(bytes_needed); assert( buffer.remaining() >= bytes_needed ); const unsigned char* p = reinterpret_cast(buffer.get_buffer()); std::transform( p, p + n, &m_image[m_y][m_x], m_palette ); m_x += n; buffer.move(bytes_needed); } // bitmap::reader::rle_bitmap_output_buffer::copy() } // namespace graphic } // namespace claw namespace claw { namespace graphic { /*------------------------------------------------------------------------*/ /** * \brief Copy some pixels directly. * \param n The number of pixels to copy. * \param buffer The input buffer, to copy from. * \remark This method is for 4bpp bitmaps. */ template<> void bitmap::reader::rle_bitmap_output_buffer::copy ( unsigned int n, file_input_buffer& buffer ) { assert( m_x + n <= m_image.width() ); // RLE bitmap data is 2-bytes aligned unsigned int bytes_needed = n / 2 + n % 2; if ( bytes_needed % 2 ) ++bytes_needed; if ( buffer.remaining() < bytes_needed ) buffer.read_more( bytes_needed ); assert( buffer.remaining() >= bytes_needed ); const unsigned char* p = reinterpret_cast(buffer.get_buffer()); const unsigned char* last = p + n / 2; for ( ; p != last; ++p, m_x += 2) { m_image[m_y][m_x] = m_palette[ (*p & 0xF0) >> 4 ]; m_image[m_y][m_x+1] = m_palette[ *p & 0x0F ]; } if ( n % 2 ) { m_image[m_y][m_x] = m_palette[ (*p & 0xF0) >> 4 ]; ++m_x; } buffer.move( bytes_needed ); } // bitmap::reader::rle_bitmap_output_buffer::copy() } // namespace graphic } // namespace claw /*----------------------------------------------------------------------------*/ /** * \brief Convert a bitset array to a pixel32 scanline. * \param dest (out) Filled scanline. * \param src Pixel array to convert. * \param palette Color palette. * \pre palette.size() == 2 */ void claw::graphic::bitmap::reader::pixel1_to_pixel32::operator() ( scanline& dest, const char* src, const color_palette_type& palette ) const { assert(palette.size() == 2); scanline::iterator it( dest.begin() ); const unsigned int n = dest.size(); const unsigned int byte_size = 8; // 8 bits per byte const unsigned int upper_bound = n / byte_size; for (unsigned int i=0; i!=upper_bound; ++i) for (unsigned int j=0; j!=byte_size; ++j, ++it) if ( src[i] & (0x80 >> j) ) *it = palette[1]; else *it = palette[0]; for (unsigned int j = 0; j != (n % byte_size); ++j, ++it) if ( src[upper_bound] & (0x80 >> j) ) *it = palette[1]; else *it = palette[0]; } // bitmap::reader::pixel1_to_pixel32() /*----------------------------------------------------------------------------*/ /** * \brief Convert a 4bpp array to a pixel32 scanline. * \param dest (out) Filled scanline. * \param src Pixel array to convert. * \param palette Color palette. * \pre palette.size() == 16 */ void claw::graphic::bitmap::reader::pixel4_to_pixel32::operator() ( scanline& dest, const char* src, const color_palette_type& palette ) const { assert(palette.size() == 16); scanline::iterator it( dest.begin() ); const unsigned int upper_bound = dest.size() / 2; for (unsigned int i=0; i!=upper_bound; ++i, ++src) { *it = palette[ (*src & 0xF0) >> 4 ]; ++it; *it = palette[ *src & 0x0F ]; ++it; } if (dest.size() % 2) *it = palette[ (*src & 0xF0) >> 4 ]; } // bitmap::reader::pixel4_to_pixel32() /*----------------------------------------------------------------------------*/ /** * \brief Convert a 8bpp array to a pixel32 scanline. * \param dest (out) Filled scanline. * \param src Pixel array to convert. * \param palette Color palette. * \pre palette.size() == 256 */ void claw::graphic::bitmap::reader::pixel8_to_pixel32::operator() ( scanline& dest, const char* src, const color_palette_type& palette ) const { assert(palette.size() == 256); const unsigned char* s = reinterpret_cast(src); std::transform(s, s + dest.size(), dest.begin(), palette); } // bitmap::reader::pixel8_to_pixel32() /*----------------------------------------------------------------------------*/ /** * \brief Convert a BGR array to a pixel32 scanline. * \param dest (out) Filled scanline. * \param src Pixel array to convert. * \param palette (not used) Color palette. */ void claw::graphic::bitmap::reader::pixel24_to_pixel32::operator() ( scanline& dest, const char* src, const color_palette_type& palette ) const { scanline::iterator it( dest.begin() ); const unsigned int upper_bound = 3 * dest.size(); for (unsigned int i=0; i!=upper_bound; i+=3) { it->components.alpha = 255; it->components.blue = src[i]; it->components.green = src[i+1]; it->components.red = src[i+2]; ++it; } } // bitmap::reader::pixel24_to_pixel32() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image in which the data will be stored. */ claw::graphic::bitmap::reader::reader( image& img ) : m_image( img ) { } // bitmap::reader::reader() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image in which the data will be stored. * \param f The file from which we read the data. * \post img contains the data from \a f. */ claw::graphic::bitmap::reader::reader( image& img, std::istream& f ) : m_image( img ) { load(f); } // bitmap::reader::reader() /*----------------------------------------------------------------------------*/ /** * \brief Load the image data from a stream. * \param f The file from which we read the data. * \post The image passed to the constructor contains the data from \a f. */ void claw::graphic::bitmap::reader::load( std::istream& f ) { CLAW_PRECOND( !!f ); std::istream::pos_type init_pos = f.tellg(); try { header h; f.read( reinterpret_cast(&h), sizeof(header) ); if ( (h.id[0] == 'B') && (h.id[1] == 'M') && (f.rdstate() == std::ios_base::goodbit) ) { m_image.set_size(h.width, h.height); switch(h.bpp) { case 1 : load_1bpp(h, f); break; case 4 : load_4bpp(h, f); break; case 8 : load_8bpp(h, f); break; //case 16 : load_16bpp(h, f); break; case 24 : load_24bpp(h, f); break; default : throw claw::bad_format ("bitmap::bitmap: unsupported color depth."); } } else throw claw::bad_format( "bitmap::bitmap: invalid header." ); } catch(...) { f.clear(); f.seekg( init_pos, std::ios_base::beg ); throw; } } // bitmap::reader::load() /*----------------------------------------------------------------------------*/ /** * \brief Load the palette of the image. * \param h File's header, must have been read before call. * \param f Bitmap file. * \param palette The loaded palette. * \pre h.bpp <= 8 */ void claw::graphic::bitmap::reader::load_palette ( const header& h, std::istream& f, color_palette_type& palette ) const { assert(h.bpp <= 8); switch(h.bpp) { case 1 : assert( palette.size() == 2 ); break; case 4 : assert( palette.size() == 16 ); break; case 8 : assert( palette.size() == 256 ); break; } const unsigned int sizeof_color = sizeof(color_palette_type::color_type); const unsigned int buffer_size = sizeof_color * palette.size(); char* buffer = new char[buffer_size]; f.read(buffer, buffer_size); for (unsigned int i=0, j=0; i!=buffer_size; i+=sizeof_color, ++j) { palette[j].components.alpha = 255; palette[j].components.blue = buffer[i]; palette[j].components.green = buffer[i+1]; palette[j].components.red = buffer[i+2]; } delete[] buffer; } // bitmap::reader::load_palette() /*----------------------------------------------------------------------------*/ /** * \brief Load a monochrome bitmap file. * \param h File's header, must have been read before call. * \param f Bitmap file. * \pre h.bpp == 1 */ void claw::graphic::bitmap::reader::load_1bpp( const header& h, std::istream& f ) { assert(h.bpp == 1); //assert(h.compression == BMP_COMPRESSION_BITFIELDS); color_palette_type palette(2); unsigned int buffer_size = m_image.width() / (sizeof(char) * 8); if ( m_image.width() % (sizeof(char) * 8) ) ++buffer_size; load_palette(h, f, palette); f.seekg(h.data_offset); load_rgb_data(f, buffer_size, palette, pixel1_to_pixel32()); } // bitmap::reader::load_1bpp() /*----------------------------------------------------------------------------*/ /** * \brief Loads a 4 bpp bitmap file. * \param h File's header, must have been read before call. * \param f Bitmap file. * \pre (h.bpp == 4) */ void claw::graphic::bitmap::reader::load_4bpp( const header& h, std::istream& f ) { assert(h.bpp == 4); assert( (h.compression == BMP_COMPRESSION_RGB) || (h.compression == BMP_COMPRESSION_RLE4) ); color_palette_type palette(16); load_palette(h, f, palette); if (h.compression == BMP_COMPRESSION_RLE4) load_4bpp_rle(h, f, palette); else load_4bpp_rgb(h, f, palette); } // bitmap::reader::load_4bpp() /*----------------------------------------------------------------------------*/ /** * \brief Loads a 8 bpp bitmap file. * \param h File's header, must have been read before call. * \param f Bitmap file. * \pre (h.bpp == 8) */ void claw::graphic::bitmap::reader::load_8bpp( const header& h, std::istream& f ) { assert(h.bpp == 8); assert( (h.compression == BMP_COMPRESSION_RGB) || (h.compression == BMP_COMPRESSION_RLE8) ); color_palette_type palette(256); load_palette(h, f, palette); if (h.compression == BMP_COMPRESSION_RLE8) load_8bpp_rle(h, f, palette); else load_8bpp_rgb(h, f, palette); } // bitmap::reader::load_8bpp() /*----------------------------------------------------------------------------*/ /** * \brief Loads a 24 bpp bitmap file. * \param h File's header, must have been read before call. * \param f Bitmap file. * \pre (h.bpp == 24) */ void claw::graphic::bitmap::reader::load_24bpp( const header& h, std::istream& f ) { assert(h.bpp == 24); unsigned int buffer_size = m_image.width() * 3; color_palette_type palette(0); f.seekg(h.data_offset); load_rgb_data(f, buffer_size, palette, pixel24_to_pixel32()); } // bitmap::reader::load_24bpp() /*----------------------------------------------------------------------------*/ /** * \brief Loads a 4 bpp RLE encoded bitmap file. * \param h File's header and palette, must have been read before call. * \param f Bitmap file. * \param palette The color palette to use for converting colors. * \pre (h.bpp == 4) && (h.compression = BMP_COMPRESSION_RLE4) * && (palette.size() == 16) */ void claw::graphic::bitmap::reader::load_4bpp_rle ( const header& h, std::istream& f, const color_palette_type& palette ) { assert(h.bpp == 4); assert(h.compression == BMP_COMPRESSION_RLE4); assert(palette.size() == 16); f.seekg(h.data_offset); rle4_decoder decoder; rle4_decoder::output_buffer_type output_buffer( palette, m_image ); file_input_buffer input_buffer(f); decoder.decode( input_buffer, output_buffer ); } // bitmap::reader::load_4bpp_rle() /*----------------------------------------------------------------------------*/ /** * \brief Loads a 4 bpp RGB encoded bitmap file. * \param h File's header and palette, must have been read before call. * \param f Bitmap file. * \param palette The color palette to use for converting colors. * \pre (h.bpp == 4) && (h.compression = BMP_COMPRESSION_RGB) * && (palette.size() == 16) */ void claw::graphic::bitmap::reader::load_4bpp_rgb ( const header& h, std::istream& f, const color_palette_type& palette ) { assert(h.bpp == 4); assert(h.compression == BMP_COMPRESSION_RGB); assert(palette.size() == 16); unsigned int buffer_size = m_image.width() / 2 + m_image.width() % 2; f.seekg(h.data_offset); load_rgb_data(f, buffer_size, palette, pixel4_to_pixel32()); } // bitmap::reader::load_4bpp_rgb() /*----------------------------------------------------------------------------*/ /** * \brief Loads a 8 bpp bitmap file. * \param h File's header and palette, must have been read before call. * \param f Bitmap file. * \param palette The color palette to use for converting colors. * \pre (h.bpp == 8) && (h.compression = BMP_COMPRESSION_RLE8) * && (palette.size() == 256) */ void claw::graphic::bitmap::reader::load_8bpp_rle ( const header& h, std::istream& f, const color_palette_type& palette ) { assert(h.bpp == 8); assert(h.compression == BMP_COMPRESSION_RLE8); assert(palette.size() == 256); f.seekg(h.data_offset); rle8_decoder decoder; rle8_decoder::output_buffer_type output_buffer( palette, m_image ); file_input_buffer input_buffer(f); decoder.decode( input_buffer, output_buffer ); } // bitmap::reader::load_8bpp_rle() /*----------------------------------------------------------------------------*/ /** * \brief Loads a 8 bpp RGB encoded bitmap file. * \param h File's header and palette, must have been read before call. * \param f Bitmap file. * \param palette The color palette to use for converting colors. * \pre (h.bpp == 8) && (h.compression = BMP_COMPRESSION_RGB) * && (palette.size() == 256) */ void claw::graphic::bitmap::reader::load_8bpp_rgb ( const header& h, std::istream& f, const color_palette_type& palette ) { assert(h.bpp == 8); assert(h.compression == BMP_COMPRESSION_RGB); assert(palette.size() == 256); unsigned int buffer_size = m_image.width(); f.seekg(h.data_offset); load_rgb_data(f, buffer_size, palette, pixel8_to_pixel32()); } // bitmap::reader::load_8bpp_rgb() libclaw-1.7.4/claw/code/bitmap_writer.cpp000066400000000000000000000104221216507631600203620ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file bitmap_writer.cpp * \brief Implementation of the claw::graphic::bitmap::writer class. * \author Julien Jorge */ #include #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image to save. */ claw::graphic::bitmap::writer::writer( const image& img ) : m_image(img) { } // bitmap::writer::writer() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image to save. * \param f The file in which we save the data. */ claw::graphic::bitmap::writer::writer( const image& img, std::ostream& f ) : m_image(img) { save(f); } // bitmap::writer::writer() /*----------------------------------------------------------------------------*/ /** * \brief Save the bitmap in a file. * \param f Destination file. */ void claw::graphic::bitmap::writer::save( std::ostream& f ) const { header h; init_header(h); f.write( reinterpret_cast(&h), sizeof(header) ); save_data( f ); } // bitmap::writer::save() /*----------------------------------------------------------------------------*/ /** * \brief Saves a 24 bpp bitmap file. * \param f Bitmap file. */ void claw::graphic::bitmap::writer::save_data( std::ostream& f ) const { unsigned int line; unsigned int buffer_size = m_image.width() * 3; // lines are 4-bytes aligned, so adjust buffer's size. if (buffer_size % 4 != 0) buffer_size += 4 - buffer_size % 4; char* buffer = new char[buffer_size]; for (line = m_image.height(); line>0; ) { --line; pixel32_to_pixel24( buffer, m_image[line] ); f.write(buffer, buffer_size); } delete[] buffer; } // bitmap::writer::save_data() /*----------------------------------------------------------------------------*/ /** * \brief Converts a pixel32 scanline to a BGR array. * \param dest (out) Filled array. * \param src Scanline to convert. */ void claw::graphic::bitmap::writer::pixel32_to_pixel24 ( char* dest, const scanline& src ) const { unsigned int i24 = 0; scanline::const_iterator first( src.begin() ); scanline::const_iterator last( src.end() ); for ( ; first!=last; ++first ) { dest[i24++] = first->components.blue; dest[i24++] = first->components.green; dest[i24++] = first->components.red; } } // bitmap::writer::pixel32_to_pixel24() /*----------------------------------------------------------------------------*/ /** * \brief Initialize header's data, for saving. * \param h Header to initialize. */ void claw::graphic::bitmap::writer::init_header( header& h ) const { unsigned int adjusted_line = m_image.width() * 3; if (m_image.width() % 4 != 0) adjusted_line += 4 - m_image.width() % 4; // for a 24 bpp bitmap. h.id[0] = 'B'; h.id[1] = 'M'; h.file_size = adjusted_line * m_image.height() + sizeof(h); h.nop = 0; // there is no color pallet, so data is just after the h h.data_offset = sizeof(h); // default value for Windows' bitmaps. h.header_size = 0x28; h.width = m_image.width(); h.height = m_image.height(); h.layers = 1; h.bpp = 24; h.compression = BMP_COMPRESSION_RGB; h.image_size = adjusted_line * m_image.height(); h.ppm_x = 0x2E23; // 11811 h.ppm_y = 0x2E23; h.colors_count = 0; h.importants_colors = 0; } // bitmap::writer::init_header() libclaw-1.7.4/claw/code/configuration_file.cpp000066400000000000000000000453531216507631600213730ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file configuration_file.cpp * \brief Implementation of the claw::configuration_file class. * \author Julien Jorge */ #include #include #include /*----------------------------------------------------------------------------*/ /** * \brief Default constructor. */ claw::configuration_file::syntax_description::syntax_description() : comment('#'), assignment('='), section_name('[', ']') { } // configuration_file::syntax_description::syntax_description() /*----------------------------------------------------------------------------*/ /** * \brief Create a comment from a string. * \param value The string to comment. */ std::string claw::configuration_file::syntax_description::make_comment ( const std::string& value ) const { return comment + (' ' + value); } // configuration_file::syntax_description::make_comment() /*----------------------------------------------------------------------------*/ /** * \brief Make an assignment of a value to a key. * \param key The key. * \param value The value given to the key. */ std::string claw::configuration_file::syntax_description::make_assignment ( const std::string& key, const std::string& value ) const { return key + ' ' + assignment + ' ' + value; } // configuration_file::syntax_description::make_assignment() /*----------------------------------------------------------------------------*/ /** * \brief Create a section name from a string. * \param name The name of the section. */ std::string claw::configuration_file::syntax_description::make_section_name ( const std::string& name ) const { return section_name.first + name + section_name.second; } // configuration_file::syntax_description::make_section_name() /*----------------------------------------------------------------------------*/ // empty string const std::string claw::configuration_file::s_unknow_field_value; /*----------------------------------------------------------------------------*/ /** * \brief Default constructor. */ claw::configuration_file::configuration_file() { // nothing to do } // configuration_file::configuration_file() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param is The stream to read from. * \param syntax Description of the file's syntax. */ claw::configuration_file::configuration_file ( std::istream& is, const syntax_description& syntax ) { open(is, syntax); } // configuration_file::configuration_file() /*----------------------------------------------------------------------------*/ /** * \brief Read the configuration from a stream. * \param is The stream to read from. * \param syntax Description of the file's syntax. */ bool claw::configuration_file::open ( std::istream& is, const syntax_description& syntax ) { std::string line; bool ok = true; section_content_ptr current_section = &m_noname_section; while ( get_line(is, syntax, line) && ok ) { text::trim_right(line, " \t"); if ( !line.empty() ) ok = process_line( line, syntax, current_section ); } return ok; } // configuration_file::open() /*----------------------------------------------------------------------------*/ /** * \brief Write the configuration in a stream. * \param os The stream to write in. * \param syntax Description of the file's syntax. */ void claw::configuration_file::save ( std::ostream& os, const syntax_description& syntax ) { if ( !m_noname_section.empty() ) { save_section_content( m_noname_section, os, syntax ); os << '\n'; } file_content::const_iterator it; for ( it=m_sections.begin(); it!=m_sections.end(); ++it ) { os << syntax.make_section_name(it->first) << '\n'; save_section_content( it->second, os, syntax ); os << '\n'; } } // configuration_file::save() /*----------------------------------------------------------------------------*/ /** * \brief Get the value of a field. * \param section The name of the section in which is the field. * \param field The name of the field to get. */ const std::string& claw::configuration_file::operator() ( const std::string& section, const std::string& field ) const { file_content::const_iterator sect = m_sections.find(section); if ( sect == m_sections.end() ) return s_unknow_field_value; else { section_content::const_iterator fld = sect->second.find(field); if ( fld == sect->second.end() ) return s_unknow_field_value; else return fld->second; } } // configuration_file::operator()() /*----------------------------------------------------------------------------*/ /** * \brief Get the value of a field. * \param field The name of the field to get. * * \remark The field is searched in the fields declared outside any section. */ const std::string& claw::configuration_file::operator()( const std::string& field ) const { section_content::const_iterator fld = m_noname_section.find(field); if ( fld == m_noname_section.end() ) return s_unknow_field_value; else return fld->second; } // configuration_file::operator()() /*----------------------------------------------------------------------------*/ /** * \brief Tell if a field exists. * \param section The name of the section containing the field. * \param field The name of the field to test. */ bool claw::configuration_file::has_field ( const std::string& section, const std::string& field ) const { return field_begin( section, field ) != field_end( section, field ); } // configuration_file::has_field() /*----------------------------------------------------------------------------*/ /** * \brief Tell if a field exists. * \param field The name of the field to test. * * \remark The field is searched outside any section. */ bool claw::configuration_file::has_field( const std::string& field ) const { return field_begin( field ) != field_end( field ); } // configuration_file::has_field() /*----------------------------------------------------------------------------*/ /** * \brief Set the value of a field. * \param section The name of the section containing the field. * \param field The name of the field to set. * \param val The value. * * This method removes all previous values for the given field. */ void claw::configuration_file::set_value ( const std::string& section, const std::string& field, const std::string& val ) { file_content::iterator it = m_sections.find(section); if ( it!=m_sections.end() ) it->second.erase(field); add_value(section, field, val); } // configuration_file::set_value() /*----------------------------------------------------------------------------*/ /** * \brief Set the value of a field. * \param field The name of the field to Set. * \param val The value. * * This method removes all previous values for the given field. * * \remark The value is inserted in the fields declared outside any section. */ void claw::configuration_file::set_value ( const std::string& field, const std::string& val ) { m_noname_section.erase(field); add_value(field, val); } // configuration_file::set_value() /*----------------------------------------------------------------------------*/ /** * \brief Add a value to a field. * \param section The name of the section containing the field. * \param field The name of the field to add. * \param val The value. * * This method keeps all previous values for the given field. */ void claw::configuration_file::add_value ( const std::string& section, const std::string& field, const std::string& val ) { m_sections[section].insert( section_content::value_type(field, val) ); } // configuration_file::add_value() /*----------------------------------------------------------------------------*/ /** * \brief Set the value of a field. * \param field The name of the field to Set. * \param val The value. * * This method keeps all previous values for the given field. */ void claw::configuration_file::add_value ( const std::string& field, const std::string& val ) { m_noname_section.insert( section_content::value_type(field, val) ); } // configuration_file::add_value() /*----------------------------------------------------------------------------*/ /** * \brief Remove a section and its fields. * \param section The name of the section to remove. */ void claw::configuration_file::clear_section( const std::string& section ) { m_sections.erase(section); } // configuration_file::clear_section() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the first value set for a field. * \param section The name of the section in which is the field. * \param field The name of the field to get. */ claw::configuration_file::const_field_iterator claw::configuration_file::field_begin ( const std::string& section, const std::string& field ) const { file_content::const_iterator it = m_sections.find(section); if (it == m_sections.end()) return const_field_iterator(); else return const_field_iterator( it->second.lower_bound(field) ); } // configuration_file::field_begin() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator past the last value set for a field. * \param section The name of the section in which is the field. * \param field The name of the field to get. */ claw::configuration_file::const_field_iterator claw::configuration_file::field_end ( const std::string& section, const std::string& field ) const { file_content::const_iterator it = m_sections.find(section); if (it == m_sections.end()) return const_field_iterator(); else return const_field_iterator( it->second.upper_bound(field) ); } // configuration_file::field_end() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the first value set for a field. * \param field The name of the field to get. * * \remark The field is searched in the fields declared outside any section. */ claw::configuration_file::const_field_iterator claw::configuration_file::field_begin( const std::string& field ) const { return const_field_iterator( m_noname_section.lower_bound(field) ); } // configuration_file::field_begin() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator past the last value set for a field. * \param field The name of the field to get. * * \remark The field is searched in the fields declared outside any section. */ claw::configuration_file::const_field_iterator claw::configuration_file::field_end( const std::string& field ) const { return const_field_iterator( m_noname_section.upper_bound(field) ); } // configuration_file::field_end() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the field names of a section. * * \remark The names are searched in the fields declared outside any section. */ claw::configuration_file::const_section_iterator claw::configuration_file::section_begin() const { return const_section_iterator( m_noname_section.begin() ); } // configuration_file::section_begin() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator past the last field name of a section. * * \remark The names are searched in the fields declared outside any section. */ claw::configuration_file::const_section_iterator claw::configuration_file::section_end() const { return const_section_iterator( m_noname_section.end() ); } // configuration_file::section_end() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the field names of a section. * \param section The name of the section in which the fields are searched. */ claw::configuration_file::const_section_iterator claw::configuration_file::section_begin( const std::string& section ) const { file_content::const_iterator it = m_sections.find(section); if (it == m_sections.end()) return const_section_iterator(); else return const_section_iterator( it->second.begin() ); } // configuration_file::section_begin() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator past the last field name of a section. * \param section The name of the section in which the fields are searched. */ claw::configuration_file::const_section_iterator claw::configuration_file::section_end( const std::string& section ) const { file_content::const_iterator it = m_sections.find(section); if (it == m_sections.end()) return const_section_iterator(); else return const_section_iterator( it->second.end() ); } // configuration_file::section_end() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the first named section. */ claw::configuration_file::const_file_iterator claw::configuration_file::file_begin() const { return const_file_iterator( m_sections.begin() ); } // configuration_file::file_begin() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator just past the last named section. */ claw::configuration_file::const_file_iterator claw::configuration_file::file_end() const { return const_file_iterator( m_sections.end() ); } // configuration_file::file_end() /*----------------------------------------------------------------------------*/ /** * \brief Get a line in the stream. * \param is The stream to read the line from. * \param syntax Description of the file's syntax. * \param line (out) The read line. */ bool claw::configuration_file::get_line ( std::istream& is, const syntax_description& syntax, std::string& line ) const { bool result = text::getline(is, line); if ( result ) { text::trim_left(line, " \t"); escape_line(is, syntax, line); } return result; } // configuration_file::get_line() /*----------------------------------------------------------------------------*/ /** * \brief Create a section or field with the content of a line. * \param line The line to process. * \param syntax Description of the file's syntax. * \param section The section we are filling. */ bool claw::configuration_file::process_line ( const std::string& line, const syntax_description& syntax, section_content_ptr& section ) { CLAW_PRECOND( !line.empty() ); bool result = true; if ( (line.size() >= 2) && (line[0] == syntax.section_name.first) && ( *(--line.end()) == syntax.section_name.second) ) { std::string section_name( line.substr(1, line.length()-2) ); text::trim( section_name, " \t" ); section = &m_sections[section_name]; } else { std::string::size_type pos = line.find_first_of(syntax.assignment); if (pos != std::string::npos) { std::string field( line.substr(0, pos) ); std::string value; if ( (pos+1) != line.length() ) { value = ( line.substr(pos+1) ); text::trim(value, " \t"); } text::trim(field, " \t"); section->insert( section_content::value_type(field, value) ); } else result = false; } return result; } // configuration_file::process_line() /*----------------------------------------------------------------------------*/ /** * \brief Convert escaped symbols from a line. * \param is The stream to read the line from. * \param syntax Description of the file's syntax. * \param line (out) The read line. */ void claw::configuration_file::escape_line ( std::istream& is, const syntax_description& syntax, std::string& line ) const { std::string input_line(line); std::string::iterator it, last; bool stop = false; line.clear(); last = input_line.begin(); for (it = last; (it!=input_line.end()) && !stop; ) if (*it == syntax.comment) stop = true; else if (*it == '\\') { line += std::string(last, it); ++it; if ( it == input_line.end() ) { std::string remaining; get_line(is, syntax, remaining); line += remaining; } else { escape_char(*it, syntax, line); ++it; } last = it; } else ++it; line += std::string(last, it); } // configuration_file::escape_line() /*----------------------------------------------------------------------------*/ /** * \brief Convert an escaped character and append it to a string. * \param escaped The character that have been escaped. * \param syntax Description of the file's syntax. * \param str (out) The string in which we add the symbol. */ void claw::configuration_file::escape_char ( char escaped, const syntax_description& syntax, std::string& str ) const { switch (escaped) { case '\'' : str += "\'"; break; case '\"' : str += "\""; break; case '\\' : str += "\\"; break; case 'a' : str += "\a"; break; case 'b' : str += "\b"; break; case 'f' : str += "\f"; break; case 'n' : str += "\n"; break; case 'r' : str += "\r"; break; case 't' : str += "\t"; break; case 'v' : str += "\v"; break; default : if ( escaped == syntax.comment ) str += syntax.comment; else (str += "\\") += escaped; } } // configuration_file::escape_char() /*----------------------------------------------------------------------------*/ /** * \brief Write the content of a section in a stream. * \param os The stream to write in. * \param c The content to write. * \param syntax Description of the file's syntax. */ void claw::configuration_file::save_section_content ( const section_content& c, std::ostream& os, const syntax_description& syntax ) const { section_content::const_iterator it; for (it=c.begin(); it!=c.end(); ++it) os << syntax.make_assignment(it->first, it->second) << '\n'; } // configuration_file::save_section_content() libclaw-1.7.4/claw/code/dynamic_library.cpp000066400000000000000000000045341216507631600206710ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file dynamic_library.cpp * \brief Implementation of the claw::dynamic_library class. * \author Julien Jorge */ #include #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param name Name of the library to load. * \param current_program Tell if the \a name parameter is the current program. */ claw::dynamic_library::dynamic_library( const std::string& name, bool current_program ) { if ( current_program ) m_handle = dynamic_library_traits::auto_open( name ); else m_handle = dynamic_library_traits::open( name ); if ( !dynamic_library_traits::valid_handle(m_handle) ) throw exception( "Can't open library '" + name + "'" ); } // dynamic_library::dynamic_library() /*----------------------------------------------------------------------------*/ /** * \brief Destructor (close the library). */ claw::dynamic_library::~dynamic_library() { dynamic_library_traits::close( m_handle ); } // dynamic_library::~dynamic_library() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the library has a symbol. * \param name The symbol to find. */ bool claw::dynamic_library::have_symbol( const std::string& name ) const { return dynamic_library_traits::have_symbol( m_handle, name ); } // dynamic_library::have_symbol() libclaw-1.7.4/claw/code/gif.cpp000066400000000000000000000151751216507631600162710ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file gif.cpp * \brief Implementation of the claw::graphic::gif class. * \author Julien Jorge */ #include "claw/gif.hpp" #include #include /*----------------------------------------------------------------------------*/ /** * \brief Tell if the file contains a global palette. */ bool claw::graphic::gif::screen_descriptor::has_global_color_table() const { return (packed & 0x80) != 0; } // gif::screen_descriptor::has_global_color_table() /*----------------------------------------------------------------------------*/ /** * \brief Get the size of the palette, if any. */ unsigned int claw::graphic::gif::screen_descriptor::color_palette_size() const { if ( !has_global_color_table() ) return 0; else return 1 << ((packed & 0x07) + 1); } // gif::screen_descriptor::color_palette_size() /*----------------------------------------------------------------------------*/ /** * \brief Get the disposal method of the frame. */ claw::graphic::gif::graphic_control_extension::disposal_method claw::graphic::gif::graphic_control_extension::get_disposal_method() const { switch( (packed & 0x1C) >> 2 ) { case 0: return dispose_none; case 1: return dispose_do_not_dispose; case 2: return dispose_background; case 3: return dispose_previous; default: return dispose_previous; } } // gif::graphic_control_extension::get_disposal_method() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the palette contains a transparent color. */ bool claw::graphic::gif::graphic_control_extension::has_transparent_color() const { return (packed & 0x01) != 0; } // gif::graphic_control_extension::has_transparent_color() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the file contains a global palette. */ bool claw::graphic::gif::image_descriptor::has_color_table() const { return (packed & 0x80) != 0; } // gif::image_descriptor::has_color_table() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the data is interlaced. */ bool claw::graphic::gif::image_descriptor::is_interlaced() const { return (packed & 0x40) != 0; } // gif::image_descriptor::is_interlaced() /*----------------------------------------------------------------------------*/ /** * \brief Get the size of the palette, if any. */ unsigned int claw::graphic::gif::image_descriptor::color_palette_size() const { if ( !has_color_table() ) return 0; else return 1 << ((packed & 0x07) + 1); } // gif::image_descriptor::color_palette_size() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ claw::graphic::gif::gif() { } // gif::gif() [copy constructor] /*----------------------------------------------------------------------------*/ /** * \brief Copy constructor. * \param that Image to copy from. */ claw::graphic::gif::gif( const gif& that ) : image(that) { frame_list::const_iterator it; for (it=that.m_frame.begin(); it!=that.m_frame.end(); ++it) m_frame.push_back( new frame(**it) ); } // gif::gif() [copy constructor] /*----------------------------------------------------------------------------*/ /** * \brief Constructor. Load an image from a gif file. * \param f Gif file. */ claw::graphic::gif::gif( std::istream& f ) { reader(*this, m_frame, f); } // gif::gif() [constructor, from file] /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ claw::graphic::gif::~gif() { std::for_each ( m_frame.begin(), m_frame.end(), claw::delete_function() ); m_frame.clear(); } // gif::~gif() /*----------------------------------------------------------------------------*/ /** * \brief Assignment. * \param that The gif to copy from. */ claw::graphic::gif& claw::graphic::gif::operator=( const gif& that ) { gif tmp(that); std::swap(tmp, *this); return *this; } // gif::operator=() /*----------------------------------------------------------------------------*/ /** * \brief Swap the content of two gifs. * \param that The gif to swap with. */ void claw::graphic::gif::swap( gif& that ) { super::swap(that); std::swap(m_frame, that.m_frame); } // gif::swap() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the beginning of the frame sequence. */ claw::graphic::gif::frame_iterator claw::graphic::gif::frame_begin() { return frame_iterator(m_frame.begin()); } // gif::begin() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the end of the frame sequence. */ claw::graphic::gif::frame_iterator claw::graphic::gif::frame_end() { return frame_iterator(m_frame.end()); } // gif::end() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the beginning of the frame sequence. */ claw::graphic::gif::const_frame_iterator claw::graphic::gif::frame_begin() const { return const_frame_iterator(m_frame.begin()); } // gif::begin() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the beginning of the frame sequence. */ claw::graphic::gif::const_frame_iterator claw::graphic::gif::frame_end() const { return const_frame_iterator(m_frame.end()); } // gif::end() /*----------------------------------------------------------------------------*/ /** * \brief Swap the content of two gifs. * \param a The gif to swap with \a b. * \param b The gif to swap with \a a. */ void std::swap( claw::graphic::gif& a, claw::graphic::gif& b ) { a.swap(b); } // swap() libclaw-1.7.4/claw/code/gif_frame.cpp000066400000000000000000000040451216507631600174350ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file gif_frame.cpp * \brief Implementation of the claw::graphic::gif::frame class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ claw::graphic::gif::frame::frame() : m_delay(0) { } // gif::frame::frame() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param w The width of the frame. * \param h The height of the frame. */ claw::graphic::gif::frame::frame( std::size_t w, std::size_t h ) : super(w, h), m_delay(0) { } // gif::frame::frame() /*----------------------------------------------------------------------------*/ /** * \brief Set the time duration of this frame. * \param d The delay. */ void claw::graphic::gif::frame::set_delay( unsigned int d ) { m_delay = d; } // gif::frame::set_delay() /*----------------------------------------------------------------------------*/ /** * \brief Get the time duration of this frame. */ unsigned int claw::graphic::gif::frame::get_delay() const { return m_delay; } // gif::frame::get_delay() libclaw-1.7.4/claw/code/gif_reader.cpp000066400000000000000000000535351216507631600176150ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file gif_reader.cpp * \brief Implementation of the claw::graphic::gif::reader class. * \author Julien Jorge */ #include #include #include #include #include #include #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param is The stream from which we read the data. * \param code_size The initial size of the codes. */ claw::graphic::gif::reader::input_buffer::input_buffer ( std::istream& is, u_int_8 code_size ) : m_val(0), m_input(is), m_pending(0), m_pending_bits(0), m_pending_end(0), m_initial_code_size(code_size), m_code_size(m_initial_code_size+1), m_code_limit(1 << m_code_size) { m_input.read ( reinterpret_cast(&m_next_data_length), sizeof(m_next_data_length) ); } // gif::reader::input_buffer::input_buffer() /*----------------------------------------------------------------------------*/ /** * \brief Tell if we reached the end of the data and we must restart the * decompression procedure. */ bool claw::graphic::gif::reader::input_buffer::end_of_data() const { return (m_val == (unsigned int)(1 << m_initial_code_size)) || end_of_information(); } // gif::reader::input_buffer::end_of_data() /*----------------------------------------------------------------------------*/ /** * \brief Tell if we reached the end of the compressed stream. */ bool claw::graphic::gif::reader::input_buffer::end_of_information() const { return !m_input || (m_val == (unsigned int)(1 << m_initial_code_size)+1) || ( (m_next_data_length == 0) // no more data in the stream && (m_pending == m_pending_end) // no more data in the buffer && (m_pending_bits < m_code_size) ); } // gif::reader::input_buffer::end_of_information() /*----------------------------------------------------------------------------*/ /** * \brief Get The count of symbols in the alphabet. */ unsigned int claw::graphic::gif::reader::input_buffer::symbols_count() const { return (1 << m_initial_code_size) + 2; } // gif::reader::input_buffer::symbols_count() /*----------------------------------------------------------------------------*/ /** * \brief Get the next code in the input. */ unsigned int claw::graphic::gif::reader::input_buffer::get_next() { if ( m_pending == m_pending_end ) fill_buffer(); else if ( m_pending_bits + (m_pending_end - m_pending - 1) * CHAR_BIT < m_code_size ) fill_buffer(); m_val = 0; std::size_t n(m_code_size); unsigned int cur_size = 0; char* buf = reinterpret_cast(&m_val); while ( (n != 0) && m_input ) { while( (m_pending_bits != 0) && (n!=0) && m_input ) { unsigned int bits = std::min((std::size_t)m_pending_bits, n); if ( CHAR_BIT - cur_size < bits ) bits = CHAR_BIT - cur_size; unsigned int mask = (1 << bits) - 1; *buf |= (m_buffer[m_pending] & mask) << cur_size; cur_size += bits; m_pending_bits -= bits; m_buffer[m_pending] >>= bits; n -= bits; if ( cur_size == CHAR_BIT ) { ++buf; cur_size = 0; } } if ( m_pending_bits == 0 ) { ++m_pending; if ( (m_pending == m_pending_end) && (n!=0) ) fill_buffer(); if ( m_pending == m_pending_end ) n = 0; else m_pending_bits = CHAR_BIT; } } return m_val; } // gif::reader::input_buffer::get_next() /*----------------------------------------------------------------------------*/ /** * \brief Reset the code size and the code limit. */ void claw::graphic::gif::reader::input_buffer::reset() { m_val = 0; m_code_size = m_initial_code_size+1; m_code_limit = 1 << m_code_size; } // gif::reader::input_buffer::reset() /*----------------------------------------------------------------------------*/ /** * \brief Inform the input buffer that a new code has been added in the * dictionary. * \param code The new code. */ void claw::graphic::gif::reader::input_buffer::new_code( unsigned int code ) { if ( (code == m_code_limit) && (m_code_size != 12) ) { ++m_code_size; m_code_limit = 1 << m_code_size; } } // gif::reader::input_buffer::new_code() /*----------------------------------------------------------------------------*/ /** * \brief Fill the input buffer. */ void claw::graphic::gif::reader::input_buffer::fill_buffer() { // move available data at the begining of the buffer std::copy( m_buffer + m_pending, m_buffer + m_pending_end, m_buffer ); m_pending_end = m_pending_end - m_pending; m_pending = 0; if (m_next_data_length != 0) { assert( m_pending_end + m_next_data_length <= sizeof(m_buffer) ); m_input.read( m_buffer + m_pending_end, m_next_data_length ); m_pending_end += m_next_data_length; if ( (m_pending_bits == 0) && (m_pending != m_pending_end) ) m_pending_bits = CHAR_BIT; m_input.read ( reinterpret_cast(&m_next_data_length), sizeof(m_next_data_length) ); } } // gif::reader::input_buffer::fill_buffer() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param p The palette from which we take the color. * \param id The descriptor of the frame. * \param transparent_color_index The index of the transparent color in \a p. * \param output The image in which we store the data. */ claw::graphic::gif::reader::output_buffer::output_buffer ( const palette_type& p, const image_descriptor& id, int transparent_color_index, image& output ) : m_palette(p), m_id(id), m_transparent_color_index(transparent_color_index), m_output(output), m_x(0), m_y(0), m_interlace_pass(0), m_interlace_step(8) { } // gif::reader::output_buffer::output_buffer() /*----------------------------------------------------------------------------*/ /** * \brief Write a data. * \param code The data to write. */ void claw::graphic::gif::reader::output_buffer::write( unsigned int code ) { assert(code < m_palette.size()); assert(m_x < m_id.width); assert(m_y < m_id.height); m_output[m_y + m_id.top][m_x + m_id.left] = m_palette[code]; if ( m_transparent_color_index != -1 ) if ( code == (unsigned int)m_transparent_color_index ) m_output[m_y + m_id.top][m_x + m_id.left].components.alpha = 0; ++m_x; if (m_x == m_id.width) { m_x = 0; if ( !m_id.is_interlaced() ) ++m_y; else { m_y += m_interlace_step; while ( (m_y >= m_id.height) && (m_interlace_pass!=3) ) { ++m_interlace_pass; switch (m_interlace_pass) { case 1: m_y = 4; m_interlace_step = 8; break; case 2: m_y = 2; m_interlace_step = 4; break; case 3: m_y = 1; m_interlace_step = 2; break; } } } } } // gif::reader::output_buffer::write() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image in which we store the data. */ claw::graphic::gif::reader::reader( image& img ) : m_image(&img) { } // gif::reader::reader() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image in which we store the data. * \param f The stream from which we read the data (gif file format). * * The first frame of the gif will be saved in the image passed to the * constructor. */ claw::graphic::gif::reader::reader( image& img, std::istream& f ) : m_image(&img) { load( f ); } // gif::reader::reader() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param frames The frames read from the file. * \param f The stream from which we read the data (gif file format). */ claw::graphic::gif::reader::reader ( frame_list& frames, std::istream& f ) : m_image(NULL) { load( f ); frames = m_frame; m_frame.clear(); } // gif::reader::reader() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image in which we store the data. * \param frames The frames read from the file. * \param f The stream from which we read the data (gif file format). * * The first frame of the gif will be saved in the image passed to the * constructor. */ claw::graphic::gif::reader::reader ( image& img, frame_list& frames, std::istream& f ) : m_image(&img) { load( f ); frames = m_frame; m_frame.clear(); } // gif::reader::reader() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ claw::graphic::gif::reader::~reader() { clear(); } // gif::reader::~reader() /*----------------------------------------------------------------------------*/ /** * \brief Load the image data from a stream. * \param f The stream from which we read the data (gif file format). */ void claw::graphic::gif::reader::load( std::istream& f ) { clear(); inside_load(f); if ( !m_frame.empty() && (m_image!=NULL) ) *m_image = *m_frame.front(); } // gif::reader::load() /*----------------------------------------------------------------------------*/ /** * \brief Clear the data read from a file. */ void claw::graphic::gif::reader::clear() { std::for_each ( m_frame.begin(), m_frame.end(), claw::delete_function() ); m_frame.clear(); } // gif::reader::clear() /*----------------------------------------------------------------------------*/ /** * \brief Load the image data from a stream. * \param f The stream from which we read the data (gif file format). */ void claw::graphic::gif::reader::inside_load( std::istream& f ) { std::istream::pos_type init_pos = f.tellg(); reader_info info; info.palette = NULL; try { check_if_gif(f); read_screen_descriptor(f, info); read_data(f, info); make_frames(info); delete info.palette; } catch(...) { delete info.palette; f.seekg( init_pos, std::ios_base::beg ); throw; } } // gif::reader::inside_load() /*----------------------------------------------------------------------------*/ /** * \brief Create the frames of the final animation. * \param info The informations on the gif file. */ void claw::graphic::gif::reader::make_frames( const reader_info& info ) { it_index it(m_frame.begin()); frame_list result; std::size_t cumul_count(0); frame cumul(info.sd.screen_width, info.sd.screen_height); frame prev; if ( !info.disposal_method.empty() ) { if ( info.disposal_method[0] == graphic_control_extension::dispose_background ) fill_background(cumul, info); else std::fill(cumul.begin(), cumul.end(), transparent_pixel); } for ( ; it!=m_frame.end(); ++it ) { if ( info.disposal_method[it] == graphic_control_extension::dispose_previous ) prev = cumul; cumul.merge(**it); cumul.set_delay( (*it)->get_delay() ); ++cumul_count; if ( cumul.get_delay() > 0 ) { result.push_back( new frame(cumul) ); cumul_count = 0; } switch( info.disposal_method[it] ) { case graphic_control_extension::dispose_background: fill_background(cumul, info); break; case graphic_control_extension::dispose_previous: cumul = prev; break; default: { /* nothing to do */ } } } if ( cumul_count != 0 ) result.push_back( new frame(cumul) ); clear(); std::swap( m_frame, result ); } // gif::reader::make_frames() /*----------------------------------------------------------------------------*/ /** * \brief Fill an image with the correct background color. * \param img The image to fill. * \param info The informations on the gif file. */ void claw::graphic::gif::reader::fill_background ( image& img, const reader_info& info ) const { rgba_pixel clr(transparent_pixel); if ( info.sd.has_global_color_table() && (info.palette != NULL) ) if (info.sd.background_color < info.palette->size() ) clr = (*info.palette)[info.sd.background_color]; std::fill( img.begin(), img.end(), clr ); } // gif::reader::fill_background() /*----------------------------------------------------------------------------*/ /** * \brief Check if a stream contains gif data. * \param f The stream to check. */ void claw::graphic::gif::reader::check_if_gif( std::istream& f ) const { CLAW_PRECOND( !!f ); header h; f.read( reinterpret_cast(&h), sizeof(header) ); bool valid = false; if ( f.rdstate() == std::ios_base::goodbit ) if ( (h.signature[0] == 'G') && (h.signature[1] == 'I') && (h.signature[2] == 'F') && (h.version[0] == '8') && ( (h.version[1] == '7') || (h.version[1] == '9') ) && (h.version[2] == 'a') ) valid = true; if ( !valid ) throw claw::bad_format( "Not a GIF file." ); } // gif::reader::check_if_gif() /*----------------------------------------------------------------------------*/ /** * \brief Read the screen descriptor and initialize the screen. * \param f The stream from which we read the data (gif file format). * \param info (out) Some global data needed when reading the file. */ void claw::graphic::gif::reader::read_screen_descriptor ( std::istream& f, reader_info& info ) { f.read( reinterpret_cast(&info.sd), sizeof(screen_descriptor) ); if ( info.sd.has_global_color_table() ) { info.palette = new palette_type(info.sd.color_palette_size()); read_palette(f, *info.palette); } } // gif::reader::read_screen_descriptor() /*----------------------------------------------------------------------------*/ /** * \brief Read a palette. * \param f The stream from which we read the palette. * \param p (out) The palette. */ void claw::graphic::gif::reader::read_palette ( std::istream& f, palette_type& p ) const { u_int_8 red, green, blue; for (std::size_t i=0; i!=p.size(); ++i) { f.read( reinterpret_cast(&red), sizeof(u_int_8) ); f.read( reinterpret_cast(&green), sizeof(u_int_8) ); f.read( reinterpret_cast(&blue), sizeof(u_int_8) ); p[i].components.red = red; p[i].components.green = green; p[i].components.blue = blue; } } // gif::reader::read_palette() /*----------------------------------------------------------------------------*/ /** * \brief Read the data of the gif stream. * \param f The stream to read. * \param info Some global data needed when reading the file. */ void claw::graphic::gif::reader::read_data ( std::istream& f, reader_info& info ) { u_int_8 code; do { code = 0; f.read( reinterpret_cast(&code), sizeof(code) ); if (f) switch(code) { case extension::block_id: f.read( reinterpret_cast(&code), sizeof(code) ); if (code == graphic_control_extension::block_label) read_frame_with_gce(f, info); else skip_extension(f); break; case image_descriptor::block_id: read_frame(f, info); break; case trailer::block_id: break; default: throw claw::bad_format( "gif::reader: invalid code" ); } } while ( f && (code != trailer::block_id) ); } // gif::reader::read_data() /*----------------------------------------------------------------------------*/ /** * \brief Read a frame without graphic control extension. * \param f The stream to read. * \param info Some global data needed when reading the file. */ void claw::graphic::gif::reader::read_frame ( std::istream& f, reader_info& info ) { frame* new_frame(NULL); try { new_frame = new frame; read_frame_data(f, info, *new_frame); info.disposal_method.push_back(graphic_control_extension::dispose_none); m_frame.push_back(new_frame); } catch(...) { delete new_frame; throw; } } // gif::reader::read_frame() /*----------------------------------------------------------------------------*/ /** * \brief Read the data of the gif stream. * \param f The stream to read. * \param info Some global data needed when reading the file. */ void claw::graphic::gif::reader::read_frame_with_gce ( std::istream& f, reader_info& info ) { graphic_control_extension gce; u_int_8 code; f.read( reinterpret_cast(&gce), sizeof(gce) ); f.read( reinterpret_cast(&code), sizeof(code) ); while ( (code == extension::block_id) && f ) { f.read( reinterpret_cast(&code), sizeof(code) ); if (code == graphic_control_extension::block_label) f.read( reinterpret_cast(&gce), sizeof(gce) ); else // unknown extension skip_extension(f); // read the code of the following block f.read( reinterpret_cast(&code), sizeof(code) ); } if (code == image_descriptor::block_id) { frame* new_frame = new frame; new_frame->set_delay(gce.delay); info.disposal_method.push_back(gce.get_disposal_method()); if ( gce.has_transparent_color() ) info.transparent_color_index = gce.transparent_color; else info.transparent_color_index = -1; read_frame_data(f, info, *new_frame); m_frame.push_back(new_frame); } } // gif::reader::read_frame_with_gce() /*----------------------------------------------------------------------------*/ /** * \brief Skip an extension block. * \param f The stream to read. * \pre The label of the extension is already read. */ void claw::graphic::gif::reader::skip_extension( std::istream& f ) const { u_int_8 block_size(0); f.read( reinterpret_cast(&block_size), sizeof(block_size) ); while ( f && (block_size!=0) ) { f.seekg( block_size, std::ios_base::cur ); f.read( reinterpret_cast(&block_size), sizeof(block_size) ); } } // gif::reader::skip_extension() /*----------------------------------------------------------------------------*/ /** * \brief Read the data of a frame. * \param f The stream to read. * \param info Some global data needed when reading the file. * \param the_frame (in/out) The frame in which we save the pixels. * \pre The cursor in the stream \a f is positioned at the beginning of an * image_descriptor block (just after the separator code). */ void claw::graphic::gif::reader::read_frame_data ( std::istream& f, const reader_info& info, frame& the_frame ) const { image_descriptor id; f.read( reinterpret_cast(&id), sizeof(id) ); the_frame.set_size(info.sd.screen_width, info.sd.screen_height); std::fill( the_frame.begin(), the_frame.end(), transparent_pixel ); palette_type* palette(info.palette); if ( id.has_color_table() ) { palette = new palette_type(id.color_palette_size()); read_palette(f, *palette); } decode_data(f, *palette, id, info.transparent_color_index, the_frame); if ( id.has_color_table() ) delete palette; } // gif::reader::read_frame_data() /*----------------------------------------------------------------------------*/ /** * \brief Decode the pixels of a frame. * \param f The stream to read. * \param palette The color palette to use. * \param id The descriptor of the current frame. * \param transparent_color_index The index of the transparent color in \a p. * \param the_frame (in/out) The frame in which we save the pixels. * \pre The cursor in the stream \a f is positioned at the beginning of an * LZW encoded block (just on the code size byte). */ void claw::graphic::gif::reader::decode_data ( std::istream& f, const palette_type& palette, const image_descriptor& id, int transparent_color_index, frame& the_frame ) const { u_int_8 code_size; f.read( reinterpret_cast(&code_size), sizeof(code_size) ); input_buffer input(f, code_size); output_buffer output(palette, id, transparent_color_index, the_frame); do { gif_lzw_decoder decoder; input.reset(); decoder.decode(input, output); } while ( !input.end_of_information() ); } // gif::reader::decode_data() libclaw-1.7.4/claw/code/image.cpp000066400000000000000000000316041216507631600166010ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file image.cpp * \brief Implementation of the claw::graphic::image class. * \author Julien Jorge */ #include #include #include #include #include #include #include #ifdef CLAW_PNG_SUPPORT /* The png.h file must be included before any other file that includes setjmp.h (as jpeg.hpp). */ #include #endif // CLAW_PNG_SUPPORT #ifdef CLAW_JPEG_SUPPORT #include #endif // CLAW_JPEG_SUPPORT #include /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the first pixel. */ claw::graphic::image::scanline::iterator claw::graphic::image::scanline::begin() { return super::begin(); } // image::scanline::begin() /*----------------------------------------------------------------------------*/ /** * \brief Get en iterator past the last pixel. */ claw::graphic::image::scanline::iterator claw::graphic::image::scanline::end() { return super::end(); } // image::scanline::end() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on constant data on the first pixel. */ claw::graphic::image::scanline::const_iterator claw::graphic::image::scanline::begin() const { return super::begin(); } // image::scanline::begin() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on constant data past the last pixel. */ claw::graphic::image::scanline::const_iterator claw::graphic::image::scanline::end() const { return super::end(); } // image::scanline::end() /*----------------------------------------------------------------------------*/ /** * \brief Get the length of the line. */ claw::graphic::image::scanline::size_type claw::graphic::image::scanline::size() const { return super::size(); } // image::scanline::size() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. Creates an image without datas. * \post width() == height() == 0 */ claw::graphic::image::image() { } // image::image() [default constructor] /*----------------------------------------------------------------------------*/ /** * \brief Constructor. Reads an image from an input stream. * \param f The stream to read from. */ claw::graphic::image::image( std::istream& f ) { load(f); } // image::image() [constructor] /*----------------------------------------------------------------------------*/ /** * \brief Constructor. Creates an empty image. * \param w Image's width. * \param h Image's height. * \pre w > 0 and h > 0 */ claw::graphic::image::image( unsigned int w, unsigned int h ) { set_size(w, h); } // image::image() [constructor] /*----------------------------------------------------------------------------*/ /** * \brief Swap the content of two images. * \param that The image to swap with. */ void claw::graphic::image::swap( image& that ) { std::swap(m_data, that.m_data); } // image::swap() /*----------------------------------------------------------------------------*/ /** * \brief Gets image's width. */ unsigned int claw::graphic::image::width() const { if ( m_data.empty() ) return 0; else return m_data[0].size(); } // image::width() /*----------------------------------------------------------------------------*/ /** * \brief Gets image's height. */ unsigned int claw::graphic::image::height() const { return m_data.size(); } // image::height() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator pointing on the first pixel. */ claw::graphic::image::iterator claw::graphic::image::begin() { return iterator(*this); } // image::begin() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator pointing just past the last pixel. */ claw::graphic::image::iterator claw::graphic::image::end() { return iterator(*this, width(), height()-1); } // image::end() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator pointing on the first pixel. */ claw::graphic::image::const_iterator claw::graphic::image::begin() const { return const_iterator(*this); } // image::begin() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator pointing just past the last pixel. */ claw::graphic::image::const_iterator claw::graphic::image::end() const { return const_iterator(*this, width(), height()-1); } // image::end() /*----------------------------------------------------------------------------*/ /** * \brief Merge an image on the current image. * \param that The image to merge. */ void claw::graphic::image::merge( const image& that ) { merge( that, math::coordinate_2d(0, 0) ); } // image::merge() /*----------------------------------------------------------------------------*/ /** * \brief Merge an image on the current image. * \param that The image to merge. * \param pos The position of the top left corner. */ void claw::graphic::image::merge ( const image& that, const math::coordinate_2d& pos ) { math::rectangle my_box(0, 0, width(), height()); math::rectangle his_box(pos.x, pos.y, that.width(), that.height()); if ( my_box.intersects( his_box ) ) { math::rectangle intersection; unsigned int that_y = pos.y < 0 ? -pos.y : 0; unsigned int that_x = pos.x < 0 ? -pos.x : 0; const double max_comp ( std::numeric_limits::max() ); intersection = my_box.intersection( his_box ); for (int y=0; y!=intersection.height; ++y) { scanline::const_iterator first = that[y + that_y].begin() + that_x; scanline::const_iterator last = first + intersection.width; scanline::iterator dest = (*this)[y + intersection.position.y].begin() + intersection.position.x; for( ; first!=last; ++first, ++dest ) { const double src_alpha( first->components.alpha ); const double dest_alpha ( dest->components.alpha * (max_comp - src_alpha) ); const double red = (double)first->components.red * src_alpha + (double)dest->components.red * dest_alpha; const double green = (double)first->components.green * src_alpha + (double)dest->components.green * dest_alpha; const double blue = (double)first->components.blue * src_alpha + (double)dest->components.blue * dest_alpha; const double alpha = src_alpha + dest_alpha; dest->components.red = std::min(red, max_comp); dest->components.green = std::min(green, max_comp); dest->components.blue = std::min(blue, max_comp); dest->components.alpha = std::min(alpha, max_comp); } } } } // image::merge() /*----------------------------------------------------------------------------*/ /** * \brief Copy an image on the current image. * \param that The image to copy. * \param pos The position of the top left corner. */ void claw::graphic::image::partial_copy (const image& that, const math::coordinate_2d& pos ) { math::rectangle my_box(0, 0, width(), height()); math::rectangle his_box(pos.x, pos.y, that.width(), that.height()); if ( my_box.intersects( his_box ) ) { math::rectangle intersection; unsigned int that_y = pos.y < 0 ? -pos.y : 0; unsigned int that_x = pos.x < 0 ? -pos.x : 0; intersection = my_box.intersection( his_box ); for (int y=0; y!=intersection.height; ++y) { scanline::const_iterator first = that[y + that_y].begin() + that_x; scanline::const_iterator last = first + intersection.width; scanline::iterator dest = (*this)[y + intersection.position.y].begin() + intersection.position.x; std::copy( first, last, dest ); } } } // image::partial_copy() /*----------------------------------------------------------------------------*/ /** * \brief Set the image upside down. */ void claw::graphic::image::flip() { for (unsigned int y=0; y!=height()/2; ++y) std::swap( m_data[y], m_data[height()-y-1] ); } // image::flip() /*----------------------------------------------------------------------------*/ /** * \brief Fill an area of the image with a given color. * \param r The area to fill. * \param c The color to fill with. */ void claw::graphic::image::fill ( const math::rectangle r, const pixel_type& c ) { math::rectangle my_box(0, 0, width(), height()); if ( my_box.intersects( r ) ) { const math::rectangle intersection( my_box.intersection( r ) ); const double max_comp ( std::numeric_limits::max() ); for (int y=0; y!=intersection.height; ++y) { scanline::iterator first = (*this)[intersection.position.y + y].begin() + intersection.position.x; const scanline::iterator last = first + intersection.width; for( ; first!=last; ++first ) { const double src_alpha(c.components.alpha); double red = (double)first->components.red + src_alpha * (double)c.components.red / max_comp; double green = (double)first->components.green + src_alpha * (double)c.components.green / max_comp; double blue = (double)first->components.blue + src_alpha * (double)c.components.blue / max_comp; double alpha = (double)first->components.alpha + (max_comp - src_alpha) / max_comp; first->components.red = std::min(red, max_comp); first->components.green = std::min(green, max_comp); first->components.blue = std::min(blue, max_comp); first->components.alpha = std::min(alpha, max_comp); } } } } // image::fill() /*----------------------------------------------------------------------------*/ /** * \brief Set a new size to the image. * \remark Image's data won't be lost. If a dimension is set larger than its * current value, extra pixels won't be initialized. * \pre (w!=0) && (h!=0) */ void claw::graphic::image::set_size( unsigned int w, unsigned int h ) { if (w == 0) m_data.clear(); else { m_data.resize(h); for (unsigned int y=0; y!=height(); ++y) m_data[y].resize(w); } } // image::set_size() /*----------------------------------------------------------------------------*/ /** * \brief Read the image from a stream. * \param f The stream to read from. */ void claw::graphic::image::load( std::istream& f ) { bool ok = false; #ifdef CLAW_JPEG_SUPPORT if (!ok) try { jpeg::reader( *this, f ); ok = true; } catch( ... ) { } #endif // CLAW_JPEG_SUPPORT #ifdef CLAW_PNG_SUPPORT if (!ok) try { png::reader( *this, f ); ok = true; } catch( ... ) { } #endif // CLAW_PNG_SUPPORT if (!ok) try { bitmap::reader( *this, f ); ok = true; } catch( ... ) { } if (!ok) try { targa::reader( *this, f ); ok = true; } catch( ... ) { } if (!ok) try { gif::reader( *this, f ); ok = true; } catch( ... ) { } if (!ok) try { pcx::reader( *this, f ); ok = true; } catch( ... ) { } if (!ok) try { xbm::reader( *this, f ); ok = true; } catch( ... ) { } if (!ok) throw claw::bad_format( "image::load: file format isn't supported." ); } // image::load() /*----------------------------------------------------------------------------*/ /** * \brief Swap the content of two images. * \param a The image to swap with \a b. * \param b The image to swap with \a a. */ void std::swap( claw::graphic::image& a, claw::graphic::image& b ) { a.swap(b); } // swap() libclaw-1.7.4/claw/code/jpeg.cpp000066400000000000000000000043441216507631600164450ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file jpeg.cpp * \brief Implementation of the claw::graphic::jpeg class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. Creates an empty image. * \param w Image's width. * \param h Image's height. * \pre w > 0 and h > 0 */ claw::graphic::jpeg::jpeg( unsigned int w, unsigned int h ) : claw::graphic::image(w, h) { } // jpeg::jpeg() [constructor] /*----------------------------------------------------------------------------*/ /** * \brief Copy constructor. * \param that Image to copy from. */ claw::graphic::jpeg::jpeg( const image& that ) : claw::graphic::image(that) { } // jpeg::jpeg() [copy constructor] /*----------------------------------------------------------------------------*/ /** * \brief Constructor. Load an image from a jpeg file. * \param f Jpeg file. */ claw::graphic::jpeg::jpeg( std::istream& f ) { reader(*this, f); } // jpeg::jpeg() [constructor, from file] /*----------------------------------------------------------------------------*/ /** * \brief Save the image. * \param f The file in which we write. * \param opt Saving options. */ void claw::graphic::jpeg::save( std::ostream& f, const writer::options& opt ) const { writer( *this, f, opt ); } // jpeg::save() libclaw-1.7.4/claw/code/jpeg_error_manager.cpp000066400000000000000000000033021216507631600213410ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file jpeg_error_manager.cpp * \brief Implementation of the claw::graphic::jpeg::error_manager class. * \author Julien Jorge */ #include #include /*----------------------------------------------------------------------------*/ /** * \brief Throw an exception when an error occurs in an internal jpeg * processing. * \param cinfo Informations about the process. */ void claw::graphic::jpeg__error_manager__error_exit(j_common_ptr cinfo) { claw::graphic::jpeg::error_manager* err = (claw::graphic::jpeg::error_manager*)cinfo->err; err->error_string = cinfo->err->jpeg_message_table[cinfo->err->msg_code]; /* Return control to the setjmp point */ longjmp(err->setjmp_buffer, 1); } // jpeg__error_manager__error_exit() libclaw-1.7.4/claw/code/jpeg_reader.cpp000066400000000000000000000240231216507631600177630ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file jpeg_reader.cpp * \brief Implementation of the claw::graphic::jpeg::reader class. * \author Julien Jorge */ #include #include #include #include /*----------------------------------------------------------------------------*/ /** * \brief Initialize the input stream. * \param cinfo Informations about the decompression. */ METHODDEF(void) claw__graphic__jpeg__source_manager__init_source(j_decompress_ptr cinfo) { // nothing to do } // claw__graphic__jpeg__source_manager__init_source() /*----------------------------------------------------------------------------*/ /** * \brief Fill the input buffer with new data. * \param cinfo Informations about the decompression. */ METHODDEF(boolean) claw__graphic__jpeg__source_manager__fill_input_buffer(j_decompress_ptr cinfo) { claw::graphic::jpeg::reader::source_manager* self = (claw::graphic::jpeg::reader::source_manager*)cinfo->client_data; CLAW_PRECOND( &self->pub == cinfo->src ); return self->fill_input_buffer(); } // claw__graphic__jpeg__source_manager__fill_input_buffer() /*----------------------------------------------------------------------------*/ /** * \brief Skip some bytes in the input buffer. * \param cinfo Informations about the decompression. * \param num_bytes The number of bytes to skip. */ METHODDEF(void) claw__graphic__jpeg__source_manager__skip_input_data(j_decompress_ptr cinfo, long num_bytes) { claw::graphic::jpeg::reader::source_manager* self = (claw::graphic::jpeg::reader::source_manager*)cinfo->client_data; CLAW_PRECOND( &self->pub == cinfo->src ); return self->skip_input_data(num_bytes); } // claw__graphic__jpeg__source_manager__skip_input_data() /*----------------------------------------------------------------------------*/ /** * \brief Close the input stream. * \param cinfo Informations about the decompression. */ METHODDEF(void) claw__graphic__jpeg__source_manager__term_source(j_decompress_ptr cinfo) { // nothing to do } // claw__graphic__jpeg__source_manager__term_source() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param is The stream we read from. */ claw::graphic::jpeg::reader::source_manager::source_manager( std::istream& is ) : m_input(is), m_buffer_size(1024), m_stream_position(0) { std::istream::pos_type pos = is.tellg(); is.seekg( 0 , std::ios_base::end ); m_stream_size = is.tellg() ; is.seekg( pos, std::ios_base::beg ) ; m_buffer = new JOCTET[m_buffer_size]; pub.bytes_in_buffer = 0; } // jpeg::reader::source_manager::source_manager() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ claw::graphic::jpeg::reader::source_manager::~source_manager() { delete[] m_buffer; } // jpeg::reader::source_manager::~source_manager() /*----------------------------------------------------------------------------*/ /** * \brief Fill the input buffer with new data. */ boolean claw::graphic::jpeg::reader::source_manager::fill_input_buffer() { unsigned int n = std::min( m_buffer_size, m_stream_size - m_stream_position ); m_input.read( (char*)m_buffer, n ); pub.next_input_byte = m_buffer; pub.bytes_in_buffer = n; m_stream_position += n; if (m_input) return TRUE; else return FALSE; } // jpeg::reader::source_manager::fill_input_buffer() /*----------------------------------------------------------------------------*/ /** * \brief Skip some bytes in the input buffer. * \param num_bytes The number of bytes to skip. */ void claw::graphic::jpeg::reader::source_manager::skip_input_data(long num_bytes) { CLAW_PRECOND(num_bytes >=0); if ( (size_t)num_bytes <= pub.bytes_in_buffer ) { pub.next_input_byte += num_bytes; pub.bytes_in_buffer -= num_bytes; } else { num_bytes -= pub.bytes_in_buffer; long div = num_bytes / m_buffer_size; long rest = num_bytes % m_buffer_size; for (long i=0; i!=(div+1); ++i) fill_input_buffer(); pub.next_input_byte += rest; pub.bytes_in_buffer -= rest; } } // jpeg::reader::source_manager::skip_input_data() /*----------------------------------------------------------------------------*/ /** * \brief Convert a RGB pixel to a ARGB pixel. */ claw::graphic::rgba_pixel_8 claw::graphic::jpeg::reader::RGB_to_pixel32::operator() ( const JSAMPLE* pixel ) const { rgba_pixel_8 result; result.components.alpha = 255; result.components.red = pixel[0]; result.components.green = pixel[1]; result.components.blue = pixel[2]; return result; } // jpeg::reader::RGB_to_pixel32::operator()() /*----------------------------------------------------------------------------*/ /** * \brief Convert a grey level pixel to a ARGB pixel. */ claw::graphic::rgba_pixel_8 claw::graphic::jpeg::reader::grayscale_to_pixel32::operator() ( const JSAMPLE* pixel ) const { rgba_pixel_8 result; result.components.alpha = 255; result.components.red = pixel[0]; result.components.green = pixel[0]; result.components.blue = pixel[0]; return result; } // jpeg::reader::grayscale_to_pixel32::operator()() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image in which the data will be stored. */ claw::graphic::jpeg::reader::reader( image& img ) : m_image( img ) { } // jpeg::reader::reader() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. Load an image from a jpeg file. * \param img The image in which the data will be stored. * \param f The file from which we read the data. * \post img contains the data from \a f. */ claw::graphic::jpeg::reader::reader( image& img, std::istream& f ) : m_image( img ) { load(f); } // jpeg::reader::reader() /*----------------------------------------------------------------------------*/ /** * \brief Load an image from a jpeg file. * \param f JPEG file. */ void claw::graphic::jpeg::reader::load( std::istream& f ) { CLAW_PRECOND( !!f ); std::istream::pos_type init_pos = f.tellg(); try { read_from_file(f); } catch(...) { f.clear(); f.seekg( init_pos, std::ios_base::beg ); throw; } } // jpeg::reader::load() /*----------------------------------------------------------------------------*/ /** * \brief Load an image from a jpeg file. * \param f Jpeg file. */ void claw::graphic::jpeg::reader::read_from_file( std::istream& f ) { source_manager infile(f); jpeg_decompress_struct cinfo; error_manager jerr; cinfo.err = jpeg_std_error(&jerr.pub); if ( setjmp(jerr.setjmp_buffer) ) throw CLAW_EXCEPTION(jerr.error_string); create_decompress_info( cinfo, infile ); jerr.pub.error_exit = jpeg__error_manager__error_exit; try { decompress(f, cinfo); jpeg_destroy_decompress(&cinfo); } catch(...) { jpeg_destroy_decompress(&cinfo); throw; } } // jpeg::reader::read_from_file() /*----------------------------------------------------------------------------*/ /** * \brief Decompress the data of a Jpeg file. * \param f Jpeg file. * \param cinfo Info on the decompression process (libjpeg concerned). */ void claw::graphic::jpeg::reader::decompress ( std::istream& f, jpeg_decompress_struct& cinfo ) { error_manager jerr; jpeg_error_mgr* jerr_saved = cinfo.err; cinfo.err = jpeg_std_error(&jerr.pub); jerr.pub.error_exit = jpeg__error_manager__error_exit; if ( setjmp(jerr.setjmp_buffer) ) { jpeg_abort_decompress(&cinfo); throw CLAW_EXCEPTION(jerr.error_string); } jpeg_read_header(&cinfo, TRUE); jpeg_start_decompress( &cinfo ); try { m_image.set_size( cinfo.image_width, cinfo.image_height ); if ( cinfo.out_color_components == 3 ) read_data( cinfo, RGB_to_pixel32() ); else if ( cinfo.out_color_components == 1 ) read_data( cinfo, grayscale_to_pixel32() ); else throw CLAW_EXCEPTION( "invalid number of colors per channel" ); jpeg_finish_decompress(&cinfo); } catch(...) { jpeg_abort_decompress(&cinfo); throw; } cinfo.err = jerr_saved; } // jpeg::reader::decompress() /*----------------------------------------------------------------------------*/ /** * \brief Initialize the jpeg decompression structure. * \param cinfo The structure to initialize. * \param infile The source manager. */ void claw::graphic::jpeg::reader::create_decompress_info ( jpeg_decompress_struct& cinfo, source_manager& infile ) const { jpeg_create_decompress(&cinfo); cinfo.src = &infile.pub; cinfo.client_data = &infile; infile.pub.fill_input_buffer = claw__graphic__jpeg__source_manager__fill_input_buffer; infile.pub.skip_input_data = claw__graphic__jpeg__source_manager__skip_input_data; infile.pub.init_source = claw__graphic__jpeg__source_manager__init_source; infile.pub.resync_to_restart = jpeg_resync_to_restart; infile.pub.term_source = claw__graphic__jpeg__source_manager__term_source; } // jpeg::reader::create_decompress_info() libclaw-1.7.4/claw/code/jpeg_writer.cpp000066400000000000000000000236471216507631600200500ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file jpeg_writer.cpp * \brief Implementation of the claw::graphic::jpeg::writer class. * \author Julien Jorge */ #include #include #include #include /*----------------------------------------------------------------------------*/ /** * \brief Initialize the output stream. * \param cinfo Informations about the compression. */ METHODDEF(void) claw__graphic__jpeg__destination_manager__init_destination(j_compress_ptr cinfo) { // nothing to do } // claw__graphic__jpeg__destination_manager__init_destination() /*----------------------------------------------------------------------------*/ /** * \brief Write the content of the buffer in the file. * \param cinfo Informations about the compression. */ METHODDEF(boolean) claw__graphic__jpeg__destination_manager__empty_output_buffer (j_compress_ptr cinfo) { claw::graphic::jpeg::writer::destination_manager* self = (claw::graphic::jpeg::writer::destination_manager*)cinfo->client_data; CLAW_PRECOND( &self->pub == cinfo->dest ); self->flush(); return TRUE; } // claw__graphic__jpeg__destination_manager__empty_output_buffer() /*----------------------------------------------------------------------------*/ /** * \brief Write the last pending bytes in the file. * \param cinfo Informations about the compression. */ METHODDEF(void) claw__graphic__jpeg__destination_manager__term_destination(j_compress_ptr cinfo) { claw::graphic::jpeg::writer::destination_manager* self = (claw::graphic::jpeg::writer::destination_manager*)cinfo->client_data; CLAW_PRECOND( &self->pub == cinfo->dest ); self->term(); } // claw__graphic__jpeg__destination_manager__term_destination() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param os The stream we write in. */ claw::graphic::jpeg::writer::destination_manager::destination_manager ( std::ostream& os ) : m_output(os), m_buffer_size(1024) { m_buffer = new JOCTET[m_buffer_size]; pub.next_output_byte = m_buffer; pub.free_in_buffer = m_buffer_size; } // jpeg::writer::destination_manager::destination_manager() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ claw::graphic::jpeg::writer::destination_manager::~destination_manager() { delete[] m_buffer; } // jpeg::writer::destination_manager::~destination_manager() /*----------------------------------------------------------------------------*/ /** * \brief Write the content of the buffer in the file. */ void claw::graphic::jpeg::writer::destination_manager::flush() { m_output.write((char*)m_buffer, m_buffer_size); pub.next_output_byte = m_buffer; pub.free_in_buffer = m_buffer_size; } // jpeg::writer::destination_manager::fill_output_buffer() /*----------------------------------------------------------------------------*/ /** * \brief Write the last pending bytes in the file. */ void claw::graphic::jpeg::writer::destination_manager::term() { m_output.write((char*)m_buffer, m_buffer_size - pub.free_in_buffer); } // jpeg::writer::destination_manager::term() /*----------------------------------------------------------------------------*/ /** * \brief Default constructor. * \remark Default options are \a quality = 75 % and \a progressive = false. */ claw::graphic::jpeg::writer::options::options() : quality(75), progressive(false) { } // jpeg::writer::options::options() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param quality_ Quality of the saved image. * \param progressive_ Tell if we save a progressive jpeg. * \remark If \a quality_ > 100, then it will be adjusted to 100 when saving. */ claw::graphic::jpeg::writer::options::options ( unsigned char quality_, bool progressive_ ) : quality(quality_), progressive(progressive_) { } // jpeg::writer::options::options() /*----------------------------------------------------------------------------*/ const unsigned int claw::graphic::jpeg::writer::s_rgb_pixel_size = 3; /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image in which the data will be stored. */ claw::graphic::jpeg::writer::writer( const image& img ) : m_image( img ) { } // jpeg::writer::writer() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. Save an image in a jpeg file. * \param img The image from which we read the data. * \param f The file in which we write the data. * \param opt Options about the saved file. */ claw::graphic::jpeg::writer::writer ( const image& img, std::ostream& f, const options& opt ) : m_image( img ) { save(f, opt); } // jpeg::writer::writer() /*----------------------------------------------------------------------------*/ /** * \brief Save an image in a jpeg file. * \param f Jpeg file. * \param opt Options about the saved file. */ void claw::graphic::jpeg::writer::save( std::ostream& f, const options& opt ) const { CLAW_PRECOND( !!f ); destination_manager outfile(f); jpeg_compress_struct cinfo; error_manager jerr; cinfo.err = jpeg_std_error(&jerr.pub); jerr.pub.error_exit = jpeg__error_manager__error_exit; if ( setjmp(jerr.setjmp_buffer) ) throw CLAW_EXCEPTION(jerr.error_string); create_compress_info( cinfo, outfile ); try { set_options( cinfo, opt ); save_image( cinfo ); jpeg_destroy_compress(&cinfo); } catch(...) { jpeg_abort_compress(&cinfo); jpeg_destroy_compress(&cinfo); throw; } } // jpeg::writer::save() /*----------------------------------------------------------------------------*/ /** * \brief Set the parameters of the JPEG saving structures. * \param cinfo JPEG file description. * \param opt Options about the saved file. */ void claw::graphic::jpeg::writer::set_options ( jpeg_compress_struct& cinfo, const options& opt ) const { cinfo.image_width = m_image.width(); /* image width, in pixels */ cinfo.image_height = m_image.height(); /* image height, in pixels */ cinfo.input_components = s_rgb_pixel_size; /* # of components per pixel */ cinfo.in_color_space = JCS_RGB; /* colorspace of input image */ jpeg_set_defaults(&cinfo); if (opt.quality > 100) jpeg_set_quality(&cinfo, 100, TRUE); else jpeg_set_quality(&cinfo, opt.quality, TRUE); if (opt.progressive) jpeg_simple_progression(&cinfo); } // jpeg::writer::set_options() /*----------------------------------------------------------------------------*/ /** * \brief Save the image in the configured stream. * \param cinfo The structure to initialize. */ void claw::graphic::jpeg::writer::save_image( jpeg_compress_struct& cinfo ) const { JSAMPLE* data = new JSAMPLE[ m_image.width() * s_rgb_pixel_size ]; error_manager jerr; jpeg_error_mgr* jerr_saved = cinfo.err; cinfo.err = jpeg_std_error(&jerr.pub); jerr.pub.error_exit = jpeg__error_manager__error_exit; if ( setjmp(jerr.setjmp_buffer) ) { delete[] data; jpeg_abort_compress(&cinfo); throw CLAW_EXCEPTION(jerr.error_string); } jpeg_start_compress( &cinfo, TRUE ); while (cinfo.next_scanline < cinfo.image_height) { copy_pixel_line( data, cinfo.next_scanline ); jpeg_write_scanlines( &cinfo, &data, 1 ); } delete[] data; jpeg_finish_compress(&cinfo); cinfo.err = jerr_saved; } // jpeg::writer::load() /*----------------------------------------------------------------------------*/ /** * \brief Copy the pixels from the image to an array of bytes. * \param data (out) The pixels for the JPEG image. * \param y Index of the line of the image from which we read the pixels. * \pre The memory pointed by data is long enough to store the pixels. */ void claw::graphic::jpeg::writer::copy_pixel_line ( JSAMPLE* data, unsigned int y ) const { CLAW_PRECOND( data ); CLAW_PRECOND( y < m_image.height() ); // three bytes for each pixel in the line for (unsigned int x=0; x!=m_image.width(); ++x, data+=s_rgb_pixel_size) { data[0] = m_image[y][x].components.red; data[1] = m_image[y][x].components.green; data[2] = m_image[y][x].components.blue; } } // jpeg::writer::copy_pixel_line() /*----------------------------------------------------------------------------*/ /** * \brief Initialize the jpeg compression structure. * \param cinfo The structure to initialize. * \param outfile The destination manager. */ void claw::graphic::jpeg::writer::create_compress_info ( jpeg_compress_struct& cinfo, destination_manager& outfile ) const { jpeg_create_compress(&cinfo); cinfo.dest = &outfile.pub; cinfo.client_data = &outfile; outfile.pub.init_destination = claw__graphic__jpeg__destination_manager__init_destination; outfile.pub.empty_output_buffer = claw__graphic__jpeg__destination_manager__empty_output_buffer; outfile.pub.term_destination = claw__graphic__jpeg__destination_manager__term_destination; } // jpeg::writer::create_compress_info() libclaw-1.7.4/claw/code/log_level.cpp000066400000000000000000000043601216507631600174660ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file log_level.cpp * \brief Implementation of the claw::log_level class. * \author Julien Jorge */ #include #include namespace claw { log_level log_error( 0, "error: " ); log_level log_warning( 1, "warning: " ); log_level log_verbose( 15 ); } // namespace claw /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param lvl The value of this level. */ claw::log_level::log_level( int lvl ) : m_level(lvl) { } // log_level::log_level() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param lvl The value of this level. * \param s The messages prefix. */ claw::log_level::log_level( int lvl, const std::string& s ) : m_level(lvl), m_prefix(s) { } // log_level::log_level() /*----------------------------------------------------------------------------*/ /** * \brief Get the level value. */ int claw::log_level::get() const { return m_level; } // log_level::get() /*----------------------------------------------------------------------------*/ /** * \brief Get the prefix. */ std::string claw::log_level::get_string() const { if (m_prefix.empty()) return m_prefix; else return claw_gettext(m_prefix.c_str()); } // log_level::get_string() libclaw-1.7.4/claw/code/log_stream.cpp000066400000000000000000000054011216507631600176470ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file log_stream.cpp * \brief Implementation of the log_stream classes. * \author Julien Jorge */ #include #include /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ claw::log_stream::~log_stream() { // nothing to do } // log_stream::~log_stream() /*----------------------------------------------------------------------------*/ /** * \brief Flush the stream */ void claw::log_stream::flush() { // nothing to do } // log_stream::flush() /*----------------------------------------------------------------------------*/ /** * \brief Write a string in the stream. */ void claw::console_logger::write( const std::string& str ) { std::clog << str; } // console_logger::write() /*----------------------------------------------------------------------------*/ /** * \brief Flush the stream */ void claw::console_logger::flush() { std::clog.flush(); } // console_logger::flush() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ claw::file_logger::file_logger( const std::string& filename ) { m_file = new std::ofstream( filename.c_str() ); } // file_logger::file_logger() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ claw::file_logger::~file_logger() { delete m_file; } // file_logger::~file_logger() /*----------------------------------------------------------------------------*/ /** * \brief Write a string in the file. */ void claw::file_logger::write( const std::string& str ) { (*m_file) << str; } // file_logger::write() /*----------------------------------------------------------------------------*/ /** * \brief Flush the stream */ void claw::file_logger::flush() { m_file->flush(); } // file_logger::flush() libclaw-1.7.4/claw/code/log_stream_concise.cpp000066400000000000000000000062111216507631600213520ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file log_stream_concise.cpp * \brief Implementation of the log_stream_concise class. * \author Julien Jorge */ #include #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param s The stream in which the messages are finally written. It will be * deleted in the destructor. * \param max_history_size The maximum number of lines in the history. */ claw::log_stream_concise::log_stream_concise ( log_stream* s, std::size_t max_history_size ) : m_stream(s), m_max_history_size(max_history_size) { } // log_stream_concise::log_stream_concise() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ claw::log_stream_concise::~log_stream_concise() { delete m_stream; } // log_stream_concise::~log_stream_concise() /*----------------------------------------------------------------------------*/ /** * \brief Write a string in the stream. * \param str The sring to write. */ void claw::log_stream_concise::write( const std::string& str ) { std::string::size_type p = str.find_first_of('\n'); if ( p == std::string::npos ) m_current_line += str; else { ++p; // includes the '\n' m_current_line += str.substr(0, p); output_current_line(); if ( p != str.length() ) write( str.substr(p) ); } } // log_stream_concise::write() /*----------------------------------------------------------------------------*/ /** * \brief Flush the stream */ void claw::log_stream_concise::flush() { m_stream->flush(); } // log_stream_concise::flush() /*----------------------------------------------------------------------------*/ /** * \brief Output the current line, if not in the history. */ void claw::log_stream_concise::output_current_line() { if ( std::find (m_previous_lines.begin(), m_previous_lines.end(), m_current_line) == m_previous_lines.end() ) { m_previous_lines.push_back( m_current_line ); m_stream->write( m_current_line ); if (m_previous_lines.size() > m_max_history_size) m_previous_lines.pop_front(); } m_current_line.clear(); } // log_stream_concise::output_current_line() libclaw-1.7.4/claw/code/log_stream_uniq.cpp000066400000000000000000000062031216507631600207040ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file log_stream_uniq.cpp * \brief Implementation of the log_stream_uniq class. * \author Julien Jorge */ #include #include #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param s The stream in which the messages are finally written. It will be * deleted in the destructor. */ claw::log_stream_uniq::log_stream_uniq( log_stream* s ) : m_stream(s), m_repetition_count(0) { } // log_stream_uniq::log_stream_uniq() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ claw::log_stream_uniq::~log_stream_uniq() { delete m_stream; } // log_stream_uniq::~log_stream_uniq() /*----------------------------------------------------------------------------*/ /** * \brief Write a string in the stream. * \param str The sring to write. */ void claw::log_stream_uniq::write( const std::string& str ) { std::string::size_type p = str.find_first_of('\n'); if ( p == std::string::npos ) m_current_line += str; else { ++p; // includes the '\n' m_current_line += str.substr(0, p); output_current_line(); if ( p != str.length() ) write( str.substr(p) ); } } // log_stream_uniq::write() /*----------------------------------------------------------------------------*/ /** * \brief Flush the stream */ void claw::log_stream_uniq::flush() { m_stream->flush(); } // log_stream_uniq::flush() /*----------------------------------------------------------------------------*/ /** * \brief Output the current line, if not in the history. */ void claw::log_stream_uniq::output_current_line() { if ( m_current_line == m_previous_line ) ++m_repetition_count; else { if ( m_repetition_count > 0 ) { std::ostringstream oss; oss << claw_gettext("(Previous line repeated ") << m_repetition_count << claw_ngettext(" time)", " times)", m_repetition_count) << '\n'; m_stream->write(oss.str()); } m_repetition_count = 0; m_previous_line = m_current_line; m_stream->write( m_current_line ); } m_current_line.clear(); } // log_stream_uniq::output_current_line() libclaw-1.7.4/claw/code/logger.cpp000066400000000000000000000115731216507631600170010ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file logger.cpp * \brief Implementation of the claw::log_system class. * \author Julien Jorge */ #include #include namespace claw { /** \brief The default log system provided by claw. */ log_system logger; } // namespace claw /*----------------------------------------------------------------------------*/ /** * \brief Default constructor. * * The logger is initialized with a console logger. */ claw::log_system::log_system() : m_log_level(-1), m_message_level(0) { } // log_system::~log_system() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ claw::log_system::~log_system() { clear(); } // log_system::~log_system() /*----------------------------------------------------------------------------*/ /** * \brief Delete the streams. */ void claw::log_system::clear() { stream_list_type::iterator it; for ( it=m_stream.begin(); it!=m_stream.end(); ++it ) delete *it; m_stream.clear(); } // log_system::clear() /*----------------------------------------------------------------------------*/ /** * \brief Add an other output stream. * \param s Dynamicaly allocated logger_stream. */ void claw::log_system::merge( stream_type* s ) { m_stream.push_front(s); } // log_system::merge() /*----------------------------------------------------------------------------*/ /** * \brief Remove a stream. * \param s The stream to remove. * \remark The search is done on the address of the pointer \a s. */ void claw::log_system::remove( const stream_type* s ) { stream_list_type::iterator it = std::find(m_stream.begin(), m_stream.end(), s); if ( it!=m_stream.end() ) m_stream.erase(it); } // log_system::remove() /*----------------------------------------------------------------------------*/ /** * \brief Set the output stream. * \param s Dynamicaly allocated logger_stream. */ void claw::log_system::set( stream_type* s ) { clear(); m_stream.push_front(s); } // log_system::set() /*----------------------------------------------------------------------------*/ /** * \brief Change the level of log. * \param lvl New level. */ void claw::log_system::set_level( int lvl ) { m_log_level = lvl; } // log_system::set_level() /*----------------------------------------------------------------------------*/ /** * \brief Change the level of log. * \param lvl New level. */ void claw::log_system::set_level( const log_level& lvl ) { m_log_level = lvl.get(); } // log_system::set_level() /*----------------------------------------------------------------------------*/ /** * \brief Flush all log streams. */ void claw::log_system::flush() { if (m_message_level <= m_log_level) { stream_list_type::iterator it; for ( it=m_stream.begin(); it!=m_stream.end(); ++it ) (*it)->flush(); } } // log_system::flush() /*----------------------------------------------------------------------------*/ /** * \brief Change the level of the next mesasges. * \param that The new level. */ claw::log_system& claw::log_system::operator<<( const log_level& that ) { m_message_level = that.get(); if (m_message_level <= m_log_level) *this << that.get_string(); return *this; } // log_system::operator<<() [log_level] /*----------------------------------------------------------------------------*/ /** * \brief Apply a stream modifier function to the log_system. * \param pf The function to apply. */ claw::log_system& claw::log_system::operator<<( log_system& (*pf)(log_system&) ) { return pf(*this); } // log_system::operator<<() [log_system& (*pf)(log_system&)] /*----------------------------------------------------------------------------*/ /** * \brief Add a new line caracter to a logger and flush it. * \param log The logger to flush. */ claw::log_system& claw::lendl( claw::log_system& log ) { return log << std::endl; } // lendl() claw::log_system& std::endl( claw::log_system& log ) { (log << "\n").flush(); return log; } // endl() libclaw-1.7.4/claw/code/pcx.cpp000066400000000000000000000042401216507631600163050ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file pcx.cpp * \brief Implementation of the pcx class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. Creates an empty image. * \param w Image's width. * \param h Image's height. * \pre w > 0 and h > 0 */ claw::graphic::pcx::pcx( unsigned int w, unsigned int h ) : claw::graphic::image(w, h) { } // pcx::pcx() [constructor] /*----------------------------------------------------------------------------*/ /** * \brief Copy constructor. * \param that Image to copy from. */ claw::graphic::pcx::pcx( const image& that ) : claw::graphic::image(that) { } // pcx::pcx() [copy constructor] /*----------------------------------------------------------------------------*/ /** * \brief Constructor. Load an image from a pcx file. * \param f Pcx file. */ claw::graphic::pcx::pcx( std::istream& f ) { reader(*this, f); } // pcx::pcx() [constructor, from file] /*----------------------------------------------------------------------------*/ /** * \brief Save the content of the image in a stream. * \param os The stream in which we write. */ void claw::graphic::pcx::save( std::ostream& os ) const { writer(*this, os); } // pcx::save() libclaw-1.7.4/claw/code/pcx_reader.cpp000066400000000000000000000331371216507631600176360ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file pcx_reader.cpp * \brief Implementation of the pcx::reader class. * \author Julien Jorge */ #include #include #include /*----------------------------------------------------------------------------*/ /** * \brief Converts a scan line of a monochrome pcx into 32 bpp pixels. * \param scanline the scan line to convert. * \param img The image in which we write the results. * \param y The line of \a img concerned by the pixels. */ void claw::graphic::pcx::reader::converter_mono::operator() ( const std::vector& scanline, image& img, unsigned int y ) const { CLAW_PRECOND( scanline.size() == 1 ); unsigned int x=0; for ( unsigned int code=0; x!=img.width(); ++code ) { u_int_8 c = scanline[0][code]; // only one color plane for monochrome pcx for( unsigned int i=0; (i!=8) && (x!=img.width()); ++x, ++i, c<<=1 ) if ( c & 0x80 ) img[y][x] = white_pixel; else img[y][x] = black_pixel; } } // pcx::reader::converter_mono::operator()() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param h The header of the pcx file (contains the color palette). */ claw::graphic::pcx::reader::converter_16::converter_16( const header& h ) : m_header(h) { } // pcx::reader::converter_16::converter_16() /*----------------------------------------------------------------------------*/ /** * \brief Converts a scan line of a 4 bpp color mapped pcx into 32 bpp pixels. * \param scanline the scan line to convert. * \param img The image in which we write the results. * \param y The line of \a img concerned by the pixels. */ void claw::graphic::pcx::reader::converter_16::operator() ( const std::vector& scanline, image& img, unsigned int y ) const { CLAW_PRECOND( scanline.size() == 4 ); unsigned int x=0; for ( unsigned int code=0; x!=img.width(); ++code ) { u_int_8 c0 = scanline[0][code]; u_int_8 c1 = scanline[1][code]; u_int_8 c2 = scanline[2][code]; u_int_8 c3 = scanline[3][code]; for( unsigned int i=0; (i!=8) && (x!=img.width()); ++x, ++i ) { unsigned int index = ( (c3 & 0x80) >> 4 ) | ( (c2 & 0x80) >> 5 ) | ( (c1 & 0x80) >> 6 ) | ( (c0 & 0x80) >> 7 ); img[y][x] = m_header.color_map[index]; c0 <<= 1; c1 <<= 1; c2 <<= 1; c3 <<= 1; } } } // pcx::reader::converter_16::operator()() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param palette The color palette of the image. */ claw::graphic::pcx::reader::converter_256::converter_256 ( const color_palette32& palette ) : m_palette(palette) { } // pcx::reader::converter_256::converter_256() /*----------------------------------------------------------------------------*/ /** * \brief Converts a scan line of a 8 bpp color mapped pcx into 32 bpp pixels. * \param scanline the scan line to convert. * \param img The image in which we write the results. * \param y The line of \a img concerned by the pixels. */ void claw::graphic::pcx::reader::converter_256::operator() ( const std::vector& scanline, image& img, unsigned int y ) const { CLAW_PRECOND( scanline.size() == 1 ); for ( unsigned int x=0; x!=img.width(); ++x ) img[y][x] = m_palette[ scanline[0][x] ]; } // pcx::reader::converter_256::operator()() /*----------------------------------------------------------------------------*/ /** * \brief Converts a scan line of a 3 planes true color pcx into 32 bpp pixels. * \param scanline the scan line to convert. * \param img The image in which we write the results. * \param y The line of \a img concerned by the pixels. */ void claw::graphic::pcx::reader::converter_true_color::operator() ( const std::vector& scanline, image& img, unsigned int y ) const { CLAW_PRECOND( scanline.size() == 3 ); for ( unsigned int x=0; x!=img.width(); ++x ) { img[y][x].components.red = scanline[0][x]; img[y][x].components.green = scanline[1][x]; img[y][x].components.blue = scanline[2][x]; img[y][x].components.alpha = std::numeric_limits::max(); } } // pcx::reader::converter_true_color::operator()() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param result The scan line in which we write the uncompressed data. * \pre \a result is big enough to store the uncompressed data. */ claw::graphic::pcx::reader::rle_pcx_output_buffer::rle_pcx_output_buffer ( color_plane_type& result ) : m_result(result), m_position(0) { } // pcx::reader::rle_pcx_output_buffer::rle_pcx_output_buffer() /*----------------------------------------------------------------------------*/ /** * \brief Copy a pixel a certain number of times. * \param n The number of pixel to write. * \param pattern The pixel to copy. */ void claw::graphic::pcx::reader::rle_pcx_output_buffer::fill ( unsigned int n, u_int_8 pattern ) { CLAW_PRECOND( m_position + n <= m_result.size() ); for (unsigned int i=0; i!=n; ++i) m_result[m_position + i] = pattern; m_position += n; } // pcx::reader::rle_pcx_output_buffer::fill() /*----------------------------------------------------------------------------*/ /** * \brief Direct copy of a certain number of pixels from the file. * \param n The number of pixels to write. * \param buffer The buffer from which we read. */ void claw::graphic::pcx::reader::rle_pcx_output_buffer::copy ( unsigned int n, rle_pcx_input_buffer& buffer ) { CLAW_ASSERT( false, "This method should not have been called" ); } // pcx::reader::rle_pcx_output_buffer::copy() /*----------------------------------------------------------------------------*/ /** * \brief Tell if we have completely filled the buffer. */ bool claw::graphic::pcx::reader::rle_pcx_output_buffer::completed() const { return m_position == m_result.size(); } // pcx::reader::rle_pcx_output_buffer::completed() /*----------------------------------------------------------------------------*/ /** * \brief Get the type of the following data in the input buffer. * \param input The input stream (the pcx file). * \param output The output stream (the pcx image). */ void claw::graphic::pcx::reader::rle_pcx_decoder::read_mode ( input_buffer_type& input, output_buffer_type& output ) { this->m_mode = this->stop; bool ok = !output.completed(); if ( ok && (input.remaining() < 1) ) ok = input.read_more(1); if (ok) { unsigned char key = input.get_next(); this->m_mode = this->compressed; if ( (key & 0xC0) == 0xC0 ) { this->m_count = key & 0x3F; if ( input.remaining() < 1 ) input.read_more(1); this->m_pattern = input.get_next(); } else { this->m_count = 1; this->m_pattern = key; } } } // pcx::reader::rle_pcx_decoder::read_mode() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image in which the data will be stored. */ claw::graphic::pcx::reader::reader( image& img ) : m_image( img ) { } // pcx::reader::reader() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image in which the data will be stored. * \param f The file from which we read the data. * \post img contains the data from \a f. */ claw::graphic::pcx::reader::reader( image& img, std::istream& f ) : m_image( img ) { load(f); } // pcx::reader::reader() /*----------------------------------------------------------------------------*/ /** * \brief Load an image from a pcx file. * \param f Pcx file. */ void claw::graphic::pcx::reader::load( std::istream& f ) { CLAW_PRECOND( !!f ); std::istream::pos_type init_pos = f.tellg(); try { header h; f.read( reinterpret_cast(&h), sizeof(header) ); if ( f.rdstate() == std::ios_base::goodbit ) { check_if_pcx(h); m_image.set_size( h.window.x_max - h.window.x_min + 1, h.window.y_max - h.window.y_min + 1 ); bool supported_format = true; switch(h.color_planes) { case 1: if (h.bpp == 1) load_mono(h, f); else if (h.bpp == 8) load_256_color_mapped(h, f); else supported_format = false; break; case 3: if (h.bpp == 8) load_true_color(h, f); else supported_format = false; break; case 4: if (h.bpp == 1) load_16_color_mapped(h, f); else supported_format = false; break; default : supported_format = false; } if ( supported_format == false ) throw claw::bad_format ( "pcx::reader::pcx: unsupported image type" ); } else throw claw::bad_format ( "claw::pcx::reader::pcx: can't read header" ); } catch(...) { f.clear(); f.seekg( init_pos, std::ios_base::beg ); throw; } } // pcx::reader::load() /*----------------------------------------------------------------------------*/ /** * \brief Check if an header seems valid for a pcx file. * \param h The header read in the file. */ void claw::graphic::pcx::reader::check_if_pcx( const header& h ) const { if ( h.manufacturer != 0x0A ) throw CLAW_EXCEPTION( "Not a Pcx file." ); } // pcx::reader::check_if_pcx() /*----------------------------------------------------------------------------*/ /** * \brief Load the monochrome pcx content. * \param h The header read in the file. * \param f The file from which we read. */ void claw::graphic::pcx::reader::load_mono( const header& h, std::istream& f ) { assert( h.color_planes == 1 ); converter_mono convert; decompress( h, f, convert ); } // pcx::reader::load_mono() /*----------------------------------------------------------------------------*/ /** * \brief Load the 16 bpp color mapped pcx content. * \param h The header read in the file. * \param f The file from which we read. */ void claw::graphic::pcx::reader::load_16_color_mapped ( const header& h, std::istream& f ) { assert( h.color_planes == 4 ); converter_16 convert(h); decompress( h, f, convert ); } // pcx::reader::load_16_color_mapped() /*----------------------------------------------------------------------------*/ /** * \brief Load the true color (24 bpp) pcx content. * \param h The header read in the file. * \param f The file from which we read. */ void claw::graphic::pcx::reader::load_true_color( const header& h, std::istream& f ) { assert( h.color_planes == 3 ); converter_true_color convert; decompress( h, f, convert ); } // pcx::reader::load_true_color() /*----------------------------------------------------------------------------*/ /** * \brief Load the 8 bpp color mapped pcx content. * \param h The header read in the file. * \param f The file from which we read. */ void claw::graphic::pcx::reader::load_256_color_mapped ( const header& h, std::istream& f ) { assert( h.color_planes == 1 ); // 256 RGB triplets const unsigned int palette_length = 256 * 3; color_palette32 palette(256); std::istream::pos_type init_pos = f.tellg(); // -1 for the check byte f.seekg( -(std::istream::off_type)palette_length - 1, std::ios_base::end ); char check; f.read(&check, 1); if ( check != 12 ) throw CLAW_EXCEPTION( "PCX: The color palette is missing." ); char buffer[palette_length]; f.read(buffer, palette_length); for (unsigned int i=0, j=0; i!=palette_length; i+=3, ++j) { palette[j].components.alpha = 255; palette[j].components.red = buffer[i]; palette[j].components.green = buffer[i+1]; palette[j].components.blue = buffer[i+2]; } f.seekg( init_pos ); converter_256 convert(palette); decompress( h, f, convert ); } // pcx::reader::load_256_color_mapped() /*----------------------------------------------------------------------------*/ /** * \brief Load the 8 bpp color mapped pcx content. * \param f The file from which we read. * \param scanline (out) Uncompressed scan line. */ void claw::graphic::pcx::reader::decompress_line ( std::istream& f, color_plane_type& scanline ) const { rle_pcx_input_buffer input(f); rle_pcx_output_buffer output(scanline); rle_pcx_decoder decoder; decoder.decode( input, output ); } // pcx::reader::decompress_line() libclaw-1.7.4/claw/code/pcx_writer.cpp000066400000000000000000000132331216507631600177030ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file pcx_writer.cpp * \brief Implementation of the pcx::writer class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param os The stream in which we write the encoded data. */ claw::graphic::pcx::writer::file_output_buffer::file_output_buffer ( std::ostream& os ) : m_stream(os) { } // pcx::writer::file_output_buffer::file_output_buffer() /*----------------------------------------------------------------------------*/ /** * \brief Encode a pixel data. * \param n The number of time the pixel appears. * \param pattern The data of the pixel. */ void claw::graphic::pcx::writer::file_output_buffer::encode ( unsigned int n, pattern_type pattern ) { if ( (pattern > 63) || (n > 1) ) { u_int_8 cnt = 0xC0 | (u_int_8)n; m_stream.write( reinterpret_cast(&cnt), sizeof(u_int_8) ); } m_stream.write( reinterpret_cast(&pattern), sizeof(u_int_8)); } // pcx::writer::file_output_buffer::encode() /*----------------------------------------------------------------------------*/ /** * \brief Get the minimum number of pixels needed for encoding. */ unsigned int claw::graphic::pcx::writer::file_output_buffer::min_interesting() const { return 1; } // pcx::writer::file_output_buffer::min_interesting() /*----------------------------------------------------------------------------*/ /** * \brief Get the maximum number of pixel a code can encode. */ unsigned int claw::graphic::pcx::writer::file_output_buffer::max_encodable() const { return 63; } // pcx::writer::file_output_buffer::max_encodable() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image to save. */ claw::graphic::pcx::writer::writer( const image& img ) : m_image(img) { } // pcx::writer::writer() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image to save. * \param f The file in which we save the data. */ claw::graphic::pcx::writer::writer( const image& img, std::ostream& f ) : m_image(img) { save(f); } // pcx::writer::writer() /*----------------------------------------------------------------------------*/ /** * \brief Save the content of the image in a stream. * \param os The stream in which we write. */ void claw::graphic::pcx::writer::save( std::ostream& os ) const { const unsigned int bytes_per_line = m_image.width() + m_image.width() % 2; write_header(os, bytes_per_line); save_rle_true_color(os, bytes_per_line); } // pcx::writer::save() /*----------------------------------------------------------------------------*/ /** * \brief Save the header of the image in a stream. * \param os The stream in which we write. * \param bytes_per_line Number of bytes per decoded line. */ void claw::graphic::pcx::writer::write_header ( std::ostream& os, unsigned int bytes_per_line ) const { header h; h.manufacturer = 10; h.version = 5; h.encoded = 1; h.bpp = 8; h.window.x_min = 0; h.window.y_min = 0; h.window.x_max = m_image.width() - 1; h.window.y_max = m_image.height() - 1; h.horizontal_dpi = 72; // arbitrary value h.vertical_dpi = 72; std::fill( h.color_map, h.color_map+16, rgb_pixel_8(0, 0, 0) ); h.reserved = 0; h.color_planes = 3; // RGB h.bytes_per_line = bytes_per_line; h.palette_info = 0; h.screen_size.horizontal = 0; h.screen_size.vertical = 0; std::fill( h.filler, h.filler+54, 0 ); os.write( reinterpret_cast(&h), sizeof(header) ); } // pcx::writer::write_header() /*----------------------------------------------------------------------------*/ /** * \brief Save the content of the image in a stream. * \param os The stream in which we write. * \param bytes_per_line Number of bytes per decoded line. */ void claw::graphic::pcx::writer::save_rle_true_color ( std::ostream& os, unsigned int bytes_per_line ) const { std::vector data(bytes_per_line, 0); rle_pcx_encoder encoder; file_output_buffer output(os); for (unsigned int y=0; y!=m_image.height(); ++y) { // red for (unsigned int x=0; x!=m_image.width(); ++x) data[x] = m_image[y][x].components.red; encoder.encode( data.begin(), data.end(), output ); // green for (unsigned int x=0; x!=m_image.width(); ++x) data[x] = m_image[y][x].components.green; encoder.encode( data.begin(), data.end(), output ); // blue for (unsigned int x=0; x!=m_image.width(); ++x) data[x] = m_image[y][x].components.blue; encoder.encode( data.begin(), data.end(), output ); } } // pcx::writer::save_rle_true_color() libclaw-1.7.4/claw/code/pixel.cpp000066400000000000000000000224631216507631600166430ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file pixel.cpp * \brief Implementation of the pixel classes. * \author Julien Jorge */ #include #include #include #include #include #include namespace claw { namespace graphic { /** \ingroup Colors. * \{ */ rgba_pixel transparent_pixel( 0, 0, 0, 0 ); rgba_pixel black_pixel ( 0, 0, 0, std::numeric_limits::max() ); rgba_pixel white_pixel ( std::numeric_limits::max(), std::numeric_limits::max(), std::numeric_limits::max(), std::numeric_limits::max() ); rgba_pixel blue_pixel ( 0, 0, std::numeric_limits::max(), std::numeric_limits::max() ); rgba_pixel green_pixel ( 0, std::numeric_limits::max(), 0, std::numeric_limits::max() ); rgba_pixel red_pixel ( std::numeric_limits::max(), 0, 0, std::numeric_limits::max() ); rgba_pixel yellow_pixel ( std::numeric_limits::max(), std::numeric_limits::max(), 0, std::numeric_limits::max() ); rgba_pixel magenta_pixel ( std::numeric_limits::max(), 0, std::numeric_limits::max(), std::numeric_limits::max() ); rgba_pixel cyan_pixel ( 0, std::numeric_limits::max(), std::numeric_limits::max(), std::numeric_limits::max() ); /** \} */ } // namespace graphic } // namespace claw /*----------------------------------------------------------------------------*/ /** * \brief Default constructor. */ claw::graphic::rgb_pixel::rgb_pixel() { } // rgb_pixel::rgb_pixel() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param r The value of the red field. * \param g The value of the green field. * \param b The value of the blue field. */ claw::graphic::rgb_pixel::rgb_pixel ( component_type r, component_type g, component_type b ) { components.red = r; components.green = g; components.blue = b; } // rgb_pixel::rgb_pixel() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param p An RGBA pixel. */ claw::graphic::rgb_pixel::rgb_pixel( const rgba_pixel& p ) { components.red = p.components.red; components.green = p.components.green; components.blue = p.components.blue; } // rgb_pixel::rgb_pixel() /*----------------------------------------------------------------------------*/ /** * \brief Constructor from a color name or code. * \param c The color name or code. */ claw::graphic::rgb_pixel::rgb_pixel( const std::string& c ) { std::istringstream iss(c); u_int_32 color; if ( c[0] == '#' ) iss.ignore(1); if ( !(iss >> std::hex >> color) ) throw std::invalid_argument(c); components.red = (color & 0xFF0000) >> (CHAR_BIT * 2); components.green = (color & 0x00FF00) >> CHAR_BIT; components.blue = color & 0x0000FF; } // rgb_pixel::rgb_pixel() /*----------------------------------------------------------------------------*/ /** * \brief Compare to a pixel. * \param that The pixel to compare to. */ bool claw::graphic::rgb_pixel::operator==(const rgb_pixel& that) const { return (components.red == that.components.red) && (components.green == that.components.green) && (components.blue == that.components.blue); } // rgb_pixel::operator==() /*----------------------------------------------------------------------------*/ /** * \brief Compare to a pixel. * \param that The pixel to compare to. */ bool claw::graphic::rgb_pixel::operator==(const rgba_pixel& that) const { return *this == rgb_pixel(that); } // rgb_pixel::operator==() /*----------------------------------------------------------------------------*/ /** * \brief Compare to a pixel. * \param that The pixel to compare to. */ bool claw::graphic::rgb_pixel::operator!=(const rgb_pixel& that) const { return !(*this == that); } // rgb_pixel::operator!=() /*----------------------------------------------------------------------------*/ /** * \brief Compare to a pixel. * \param that The pixel to compare to. */ bool claw::graphic::rgb_pixel::operator!=(const rgba_pixel& that) const { return !(*this == that); } // rgb_pixel::operator!=() /*----------------------------------------------------------------------------*/ /** * \brief Default constructor. */ claw::graphic::rgba_pixel::rgba_pixel() { } // rgba_pixel::rgba_pixel() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param that The other pixel. * \remark The alpha component of \a this is set to 255. */ claw::graphic::rgba_pixel::rgba_pixel( const rgb_pixel& that ) { components.red = that.components.red; components.green = that.components.green; components.blue = that.components.blue; components.alpha = 255; } // rgba_pixel::rgba_pixel() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param r The value of the red field. * \param g The value of the green field. * \param b The value of the blue field. * \param a The value of the alpha field. */ claw::graphic::rgba_pixel::rgba_pixel ( component_type r, component_type g, component_type b, component_type a ) { components.red = r; components.green = g; components.blue = b; components.alpha = a; } // rgba_pixel::rgba_pixel() /*----------------------------------------------------------------------------*/ /** * \brief Constructor from a color name or code. * \param c The color name or code. */ claw::graphic::rgba_pixel::rgba_pixel( const std::string& c ) { std::istringstream iss(c); u_int_32 color; bool has_alpha; if ( c[0] == '#' ) { iss.ignore(1); has_alpha = c.length() > 7; } else has_alpha = c.length() > 6; if ( !((iss >> std::hex >> color) && (iss.rdbuf()->in_avail() == 0)) ) throw std::invalid_argument(c); if ( has_alpha ) components.alpha = (color & 0xFF000000) >> (CHAR_BIT * 3); else components.alpha = std::numeric_limits::max(); components.red = (color & 0xFF0000) >> (CHAR_BIT * 2); components.green = (color & 0x00FF00) >> CHAR_BIT; components.blue = color & 0x0000FF; } // rgba_pixel::rgba_pixel() /*----------------------------------------------------------------------------*/ /** * \brief Assignement operator. * \param that The other pixel. * \remark The alpha component of \a this is set to 255. */ claw::graphic::rgba_pixel& claw::graphic::rgba_pixel::operator=( const rgb_pixel& that ) { components.red = that.components.red; components.green = that.components.green; components.blue = that.components.blue; components.alpha = 255; return *this; } // rgba_pixel::operator=() /*----------------------------------------------------------------------------*/ /** * \brief Tell if two pixels are equal. * \param that The other pixel. */ bool claw::graphic::rgba_pixel::operator==( const rgba_pixel& that ) const { return pixel == that.pixel; } // rgba_pixel::operator==() /*----------------------------------------------------------------------------*/ /** * \brief Tell if two pixels are different. * \param that The other pixel. */ bool claw::graphic::rgba_pixel::operator!=( const rgba_pixel& that ) const { return pixel != that.pixel; } // rgba_pixel::operator!=() /*----------------------------------------------------------------------------*/ /** * \brief Get the luminosity of the pixel. * \return The luminosity between 0 (dark) and 255 (light). * * The luminosity is approximated with integers: * \f$0,715160 \simeq 183 \div 256 = 0,71484375 \f$ * \f$0,212671 \simeq 54 \div 256 = 0,2109375 \f$ * \f$0,072169 \simeq 18 \div 256 = 0,0703125 \f$ */ claw::graphic::rgba_pixel::component_type claw::graphic::rgba_pixel::luminosity() const { return ((unsigned int)components.red * 183 + (unsigned int)components.green * 54 + (unsigned int)components.blue * 18 ) / 256; } // rgba_pixel::luminosity() libclaw-1.7.4/claw/code/png.cpp000066400000000000000000000042631216507631600163040ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file png.cpp * \brief Implementation of the claw::graphic::png class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. Creates an empty image. * \param w Image's width. * \param h Image's height. * \pre w > 0 and h > 0 */ claw::graphic::png::png( unsigned int w, unsigned int h ) : image(w, h) { } // png::png() [constructor] /*----------------------------------------------------------------------------*/ /** * \brief Copy constructor. * \param that Image to copy from. */ claw::graphic::png::png( const image& that ) : image(that) { } // png::png() [copy constructor] /*----------------------------------------------------------------------------*/ /** * \brief Constructor. Load an image from a png file. * \param f Png file. */ claw::graphic::png::png( std::istream& f ) { reader(*this, f); } // png::png() [constructor, from file] /*----------------------------------------------------------------------------*/ /** * \brief Save the image. * \param f The file in which we write. * \param opt Saving options. */ void claw::graphic::png::save( std::ostream& f, const writer::options& opt ) const { writer( *this, f, opt ); } // png::save() libclaw-1.7.4/claw/code/png_reader.cpp000066400000000000000000000254731216507631600176340ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file png_reader.cpp * \brief Implementation of the claw::graphic::png::reader class. * \author Julien Jorge */ #include #include #include #include /*----------------------------------------------------------------------------*/ /** * \brief Read data from the input stream. * \param png_ptr Informations about the PNG we are reading. * \param data (out) Array of the bytes we have read. * \param length Number of bytes to read. */ void claw__graphic__png__source_manager__read ( png_structp png_ptr, png_bytep data, png_size_t length ) { claw::graphic::png::reader::source_manager* self = (claw::graphic::png::reader::source_manager*)png_get_io_ptr(png_ptr); self->read(data, length); } // claw__graphic__png__source_manager__read() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param is The stream we read from. */ claw::graphic::png::reader::source_manager::source_manager( std::istream& is ) : m_input(is) { CLAW_PRECOND( !!is ); } // png::reader::source_manager::source_manager() /*----------------------------------------------------------------------------*/ /** * \brief Read data from the input stream. * \param data (out) Array of the bytes we have read. * \param length Number of bytes to read. */ void claw::graphic::png::reader::source_manager::read ( png_bytep data, png_size_t length ) { m_input.read( (char*)data, length * sizeof(png_byte) ); } // png::reader::source_manager::read() /*----------------------------------------------------------------------------*/ const unsigned int claw::graphic::png::reader::s_rgba_pixel_size = 4; /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image in which the data will be stored. */ claw::graphic::png::reader::reader( image& img ) : m_image( img ) { } // png::reader::reader() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image in which the data will be stored. * \param f The file from which we read the data. * \post img contains the data from \a f. */ claw::graphic::png::reader::reader( image& img, std::istream& f ) : m_image( img ) { load(f); } // png::reader::reader() /*----------------------------------------------------------------------------*/ /** * \brief Load an image from a png file. * \param f PNG file. */ void claw::graphic::png::reader::load( std::istream& f ) { CLAW_PRECOND( !!f ); std::istream::pos_type init_pos = f.tellg(); try { read_from_file(f); } catch(...) { f.clear(); f.seekg( init_pos, std::ios_base::beg ); throw; } } // png::reader::load() /*----------------------------------------------------------------------------*/ /** * \brief Load an image from a png file. * \param f PNG file. */ void claw::graphic::png::reader::read_from_file( std::istream& f ) { source_manager infile(f); png_structp png_ptr; png_infop info_ptr; create_read_structures(png_ptr, info_ptr); if (setjmp(png_jmpbuf(png_ptr))) { /* If we get here, we had a problem reading the file */ /* Free all of the memory associated with the png_ptr and info_ptr */ png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); throw CLAW_EXCEPTION("Invalid PNG file."); } check_if_png( png_ptr, f ); png_set_read_fn( png_ptr, (void *)&infile, claw__graphic__png__source_manager__read ); png_read_info(png_ptr, info_ptr); png_set_strip_16(png_ptr); png_set_expand_gray_1_2_4_to_8(png_ptr); png_set_packing(png_ptr); png_set_tRNS_to_alpha(png_ptr); // transform palette index into RGB value png_set_palette_to_rgb(png_ptr); // add an alpha value if none png_set_filler( png_ptr, std::numeric_limits::max(), PNG_FILLER_AFTER ); png_read_update_info(png_ptr, info_ptr); read_image( png_ptr, info_ptr ); png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); } // png::reader::read_from_file() /*----------------------------------------------------------------------------*/ /** * \brief Check that the stream contains a PNG file. * \param png_ptr PNG file description. * \param f The stream to read from. */ void claw::graphic::png::reader::check_if_png ( png_structp png_ptr, std::istream& f ) const { CLAW_PRECOND( !!f ); const unsigned int bytes_to_check = 8; png_byte buffer[bytes_to_check]; /* Read in some of the signature bytes */ f.read( (char*)buffer, bytes_to_check * sizeof(png_byte) ); if ( (png_sig_cmp(buffer, (png_size_t)0, bytes_to_check) != 0) || !f ) throw CLAW_EXCEPTION( "Not a PNG file." ); png_set_sig_bytes(png_ptr, bytes_to_check); } // png::reader::check_if_png() /*----------------------------------------------------------------------------*/ /** * \brief Read the image data of the PNG. * \param png_ptr PNG file description. * \param info_ptr PNG file informations. */ void claw::graphic::png::reader::read_image ( png_structp png_ptr, png_infop info_ptr ) { CLAW_PRECOND( png_ptr ); CLAW_PRECOND( info_ptr ); m_image.set_size( png_get_image_width(png_ptr, info_ptr), png_get_image_height(png_ptr, info_ptr) ); if ( png_get_interlace_type(png_ptr, info_ptr) == PNG_INTERLACE_NONE ) read_sequential_image(png_ptr, info_ptr); else read_interlaced_image( png_ptr, info_ptr, png_set_interlace_handling(png_ptr) ); } // png::reader::read_image() /*----------------------------------------------------------------------------*/ /** * \brief Read the image data of a non interlaced PNG. * \param png_ptr PNG file description. * \param info_ptr PNG file informations. */ void claw::graphic::png::reader::read_sequential_image ( png_structp png_ptr, png_infop info_ptr ) { CLAW_PRECOND( png_ptr ); CLAW_PRECOND( info_ptr ); png_bytep data = (png_bytep)png_malloc( png_ptr, s_rgba_pixel_size * m_image.width() ); const png_byte color_type( png_get_color_type(png_ptr, info_ptr) ); try { for (unsigned int y=0; y!=m_image.height(); ++y) { png_read_row(png_ptr, data, NULL); copy_pixel_line( color_type, data, y ); } } catch(...) { png_free(png_ptr, data); throw; } png_free(png_ptr, data); } // png::reader::read_sequential_image() /*----------------------------------------------------------------------------*/ /** * \brief Read the image data of an interlaced PNG. * \param png_ptr PNG file description. * \param info_ptr PNG file informations. * \param passes Number of passes (for interlaced images). */ void claw::graphic::png::reader::read_interlaced_image ( png_structp png_ptr, png_infop info_ptr, unsigned int passes ) { CLAW_PRECOND( passes > 1 ); CLAW_PRECOND( png_ptr ); CLAW_PRECOND( info_ptr ); const unsigned int row_length = s_rgba_pixel_size * m_image.width(); png_bytepp data = (png_bytepp)png_malloc( png_ptr, sizeof(png_bytep) * m_image.height() ); unsigned int i=0; const png_byte color_type( png_get_color_type(png_ptr, info_ptr) ); try { for (i=0; i!=m_image.height(); ++i) { data[i] = (png_bytep)png_malloc( png_ptr, row_length ); if (!data[i]) throw std::bad_alloc(); copy_pixel_line( color_type, data[i], i ); } for (unsigned int p=0; p!=passes; ++p) png_read_rows( png_ptr, data, NULL, m_image.height() ); for (unsigned int y=0; y!=m_image.height(); ++y) copy_pixel_line( color_type, data[y], y ); } catch(...) { for(unsigned int j=0; j!=i; ++j) png_free(png_ptr, data[j]); png_free(png_ptr, data); throw; } for(i=0; i!=m_image.height(); ++i) png_free(png_ptr, data[i]); png_free(png_ptr, data); } // png::reader::read_interlaced_image() /*----------------------------------------------------------------------------*/ /** * \brief Copy the pixels taken from the PNG to the image. * \param color_type The structure of the colors in the data. * \param data the pixels from the PNG image. * \param y Index of the line of the image in which we copy the pixels. */ void claw::graphic::png::reader::copy_pixel_line ( png_byte color_type, png_bytep data, unsigned int y ) { CLAW_PRECOND( data ); CLAW_PRECOND( y < m_image.height() ); if ( color_type == PNG_COLOR_TYPE_GRAY_ALPHA ) // There is two bytes for each pixel in the line: the color and the opacity. for (unsigned int x=0; x!=m_image.width(); ++x, data += 2) { m_image[y][x].components.red = data[0]; m_image[y][x].components.green = data[0]; m_image[y][x].components.blue = data[0]; m_image[y][x].components.alpha = data[1]; } else // There is four bytes for each pixel in the line. for (unsigned int x=0; x!=m_image.width(); ++x, data+=s_rgba_pixel_size) { m_image[y][x].components.red = data[0]; m_image[y][x].components.green = data[1]; m_image[y][x].components.blue = data[2]; m_image[y][x].components.alpha = data[3]; } } // png::reader::copy_pixel_line() /*----------------------------------------------------------------------------*/ /** * \brief Initialize the png read structures. * \param png_ptr PNG file description. * \param info_ptr PNG file informations. */ void claw::graphic::png::reader::create_read_structures ( png_structp& png_ptr, png_infop& info_ptr ) const { png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png_ptr) { info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL); } if (!png_ptr || !info_ptr) throw CLAW_EXCEPTION("Can't create PNG read structures."); } // png::reader::create_read_structures() libclaw-1.7.4/claw/code/png_writer.cpp000066400000000000000000000222301216507631600176720ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file png_writer.cpp * \brief Implementation of the claw::graphic::png::writer class. * \author Julien Jorge */ #include #include #include /*----------------------------------------------------------------------------*/ /** * \brief Write data in the ouput stream. * \param png_ptr Informations about the PNG we are writing. * \param data (out) Array of the bytes to write. * \param length Number of bytes to write. */ void claw__graphic__png__target_manager__write ( png_structp png_ptr, png_bytep data, png_size_t length ) { claw::graphic::png::writer::target_manager* self = (claw::graphic::png::writer::target_manager*)png_get_io_ptr(png_ptr); self->write(data, length); } // claw__graphic__png__target_manager__write() /*----------------------------------------------------------------------------*/ /** * \brief Flush the output stream. * \param png_ptr Informations about the PNG we are writing. */ void claw__graphic__png__target_manager__flush( png_structp png_ptr ) { claw::graphic::png::writer::target_manager* self = (claw::graphic::png::writer::target_manager*)png_get_io_ptr(png_ptr); self->flush(); } // claw__graphic__png__target_manager__write() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param os The stream in which we write. */ claw::graphic::png::writer::target_manager::target_manager( std::ostream& os ) : m_output(os) { CLAW_PRECOND( !!os ); } // png::writer::target_manager::target_manager() /*----------------------------------------------------------------------------*/ /** * \brief Write data in the ouput stream. * \param data (out) Array of the bytes to write. * \param length Number of bytes to write. */ void claw::graphic::png::writer::target_manager::write ( png_bytep data, png_size_t length ) { m_output.write( (char*)data, length * sizeof(png_byte) ); } // png::writer::target_manager::write() /*----------------------------------------------------------------------------*/ /** * \brief Flush the output stream. */ void claw::graphic::png::writer::target_manager::flush() { m_output.flush(); } // png::writer::target_manager::flush() /*----------------------------------------------------------------------------*/ /** * \brief Default constructor. */ claw::graphic::png::writer::options::options() : compression(default_compression), interlace(none) { } // png::writer::options::options() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param compression_level_ Compression level to use in the saved stream. * \param interlace_ Interlace method to apply to the saved image. */ claw::graphic::png::writer::options::options ( compression_level compression_level_, interlace_type interlace_ ) : compression(compression_level_), interlace(interlace_) { } // png::writer::options::options() /*----------------------------------------------------------------------------*/ const unsigned int claw::graphic::png::writer::s_rgba_pixel_size = 4; /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image in which the data will be stored. */ claw::graphic::png::writer::writer( const image& img ) : m_image( img ) { } // png::writer::writer() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image to save. * \param f The file in which we write the data. * \param opt Saving options. */ claw::graphic::png::writer::writer ( const image& img, std::ostream& f, const options& opt ) : m_image( img ) { save(f, opt); } // png::writer::writer() /*----------------------------------------------------------------------------*/ /** * \brief Save the image in a PNG file. * \param f PNG file. * \param opt Saving options. */ void claw::graphic::png::writer::save( std::ostream& f, const options& opt ) const { CLAW_PRECOND( !!f ); target_manager outfile(f); png_structp png_ptr; png_infop info_ptr; create_write_structures(png_ptr, info_ptr); if (setjmp(png_jmpbuf(png_ptr))) { /* If we get here, we had a problem reading the file */ /* Free all of the memory associated with the png_ptr and info_ptr */ png_destroy_write_struct(&png_ptr, &info_ptr); throw CLAW_EXCEPTION("Invalid PNG file."); } png_set_write_fn( png_ptr, (void *)&outfile, claw__graphic__png__target_manager__write, claw__graphic__png__target_manager__flush ); set_options( png_ptr, info_ptr, opt ); save_image( png_ptr, info_ptr ); png_destroy_write_struct(&png_ptr, &info_ptr); } // png::writer::save() /*----------------------------------------------------------------------------*/ /** * \brief Set the parameters of the PNG saving structures. * \param png_ptr PNG file description. * \param info_ptr PNG file informations. * \param opt Compression options. */ void claw::graphic::png::writer::set_options ( png_structp png_ptr, png_infop info_ptr, const options& opt ) const { CLAW_PRECOND( png_ptr ); CLAW_PRECOND( info_ptr ); png_set_compression_level( png_ptr, opt.compression ); png_set_IHDR( png_ptr, info_ptr, m_image.width(), m_image.height(), sizeof(pixel_type::component_type) * 8, /* 8 bits per byte */ PNG_COLOR_TYPE_RGB_ALPHA, opt.interlace, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT ); } // png::writer::set_options() /*----------------------------------------------------------------------------*/ /** * \brief Save the image in a configured PNG file. * \param png_ptr PNG file description. * \param info_ptr PNG file informations. */ void claw::graphic::png::writer::save_image ( png_structp png_ptr, png_infop info_ptr ) const { CLAW_PRECOND( png_ptr ); CLAW_PRECOND( info_ptr ); const unsigned int row_length = s_rgba_pixel_size * m_image.width(); png_bytepp data = (png_bytepp)png_malloc( png_ptr, sizeof(png_bytep) * m_image.height() ); unsigned int i=0; try { for (i=0; i!=m_image.height(); ++i) { data[i] = (png_bytep)png_malloc( png_ptr, row_length ); if (!data[i]) throw std::bad_alloc(); copy_pixel_line( data[i], i ); } png_set_rows(png_ptr, info_ptr, data); png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL); } catch(...) { for(unsigned int j=0; j!=i; ++j) png_free(png_ptr, data[j]); png_free(png_ptr, data); throw; } for(i=0; i!=m_image.height(); ++i) png_free(png_ptr, data[i]); png_free(png_ptr, data); } // png::writer::save_image() /*----------------------------------------------------------------------------*/ /** * \brief Copy the pixels from the image to an array of bytes. * \param data (out) The pixels for the PNG image. * \param y Index of the line of the image from which we read the pixels. * \pre The memory pointed by data is long enough to store the pixels. */ void claw::graphic::png::writer::copy_pixel_line ( png_bytep data, unsigned int y ) const { CLAW_PRECOND( data ); CLAW_PRECOND( y < m_image.height() ); // four bytes for each pixel in the line for (unsigned int x=0; x!=m_image.width(); ++x, data+=s_rgba_pixel_size) { data[0] = m_image[y][x].components.red; data[1] = m_image[y][x].components.green; data[2] = m_image[y][x].components.blue; data[3] = m_image[y][x].components.alpha; } } // png::writer::copy_pixel_line() /*----------------------------------------------------------------------------*/ /** * \brief Initialize the png write structures. * \param png_ptr PNG file description. * \param info_ptr PNG file informations. */ void claw::graphic::png::writer::create_write_structures ( png_structp& png_ptr, png_infop& info_ptr ) const { png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png_ptr) { info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) png_destroy_write_struct(&png_ptr, (png_infopp)NULL); } if (!png_ptr || !info_ptr) throw CLAW_EXCEPTION("Can't create PNG write structures."); } // png::writer::create_write_structures() libclaw-1.7.4/claw/code/socket_server.cpp000066400000000000000000000071641216507631600204010ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file socket_server.cpp * \brief Implantation of the claw::net::socket_server class. * \author Julien Jorge */ #include #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \post is_open() == false */ claw::net::socket_server::socket_server() { // nothing to do } // socket_server::socket_server() /*----------------------------------------------------------------------------*/ /** * \brief Constructor, open the socket. * \param port The port to bind. * \param queue_size The size of the waiting queue for incoming connections. */ claw::net::socket_server::socket_server( int port, unsigned int queue_size ) { open(port, queue_size); } // socket_server::socket_server() /*----------------------------------------------------------------------------*/ /** * \brief Open the socket. * \param port The port to bind. * \param queue_size The size of the waiting queue for incoming connections. * \return this if everything works fine, NULL otherwise. */ claw::net::socket_server* claw::net::socket_server::open( int port, unsigned int queue_size ) { socket_server* result = NULL; if ( basic_socket::open() ) { if ( !socket_traits::listen(m_descriptor, port, queue_size) ) basic_socket::close(); else result = this; } return result; } // socket_server::open() /*----------------------------------------------------------------------------*/ /** * \brief Close the socket. */ claw::net::socket_server* claw::net::socket_server::close() { if ( basic_socket::close() ) return this; else return NULL; } // socket_server::close() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the server is open. */ bool claw::net::socket_server::is_open() const { return basic_socket::is_open(); } // socket_server::is_open() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the server is working. */ claw::net::socket_server::operator bool() const { return is_open(); } // socket_server::operator bool() /*----------------------------------------------------------------------------*/ /** * \brief Initialize the use of the socket library. * \return true if the initialization is successful. */ bool claw::net::socket_server::init() { return socket_traits::init(); } // socket_server::init() /*----------------------------------------------------------------------------*/ /** * \brief Close the socket library. * \return true if the operation is successful. */ bool claw::net::socket_server::release() { return socket_traits::release(); } // socket_server::release() libclaw-1.7.4/claw/code/targa.cpp000066400000000000000000000044041216507631600166130ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file targa.cpp * \brief Implementation of the targa class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. Creates an empty image. * \param w Image's width. * \param h Image's height. * \pre w > 0 and h > 0 */ claw::graphic::targa::targa( unsigned int w, unsigned int h ) : claw::graphic::image(w, h) { } // targa::targa() [constructor] /*----------------------------------------------------------------------------*/ /** * \brief Copy constructor. * \param that Image to copy from. */ claw::graphic::targa::targa( const image& that ) : claw::graphic::image(that) { } // targa::targa() [copy constructor] /*----------------------------------------------------------------------------*/ /** * \brief Constructor. Load an image from a targa file. * \param f Targa file. */ claw::graphic::targa::targa( std::istream& f ) { reader(*this, f); } // targa::targa() [constructor, from file] /*----------------------------------------------------------------------------*/ /** * \brief Save the content of the image in a stream. * \param os The stream in which we write. * \param rle Tell if we must encode the data. */ void claw::graphic::targa::save( std::ostream& os, bool rle ) const { writer(*this, os, rle); } // targa::save() libclaw-1.7.4/claw/code/targa_file_structure.cpp000066400000000000000000000103141216507631600217270ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file targa_file_structure.cpp * \brief Implementation of the targa::file_structure class. * \author Julien Jorge */ #include //************************ targa::file_structure::header *********************** /*----------------------------------------------------------------------------*/ /** * \brief Default constructor. */ claw::graphic::targa::file_structure::header::header() { } // targa::file_structure::header::header() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param w The width of the image. * \param h The height of the image. */ claw::graphic::targa::file_structure::header::header ( unsigned int w, unsigned int h ) { id_length = 0; color_map = 0; image_type = true_color; color_map_specification.first_entry_index = 0; color_map_specification.length = 0; color_map_specification.entry_size = 0; image_specification.x_origin = 0; image_specification.y_origin = 0; image_specification.width = w; image_specification.height = h; image_specification.bpp = 32; // pixel32 image_specification.descriptor = 8; // unsigned char image_specification.descriptor |= 0x20; // origin is top-left } // targa::file_structure::header::header() //************** targa::file_structure::header::specification ****************** /*----------------------------------------------------------------------------*/ /** * \brief Is image stored up to down ? */ bool claw::graphic::targa::file_structure::header::specification:: up_down_oriented() const { return descriptor & 0x20; } // targa::file_structure::header::specification::up_down_oriented() /*----------------------------------------------------------------------------*/ /** * \brief Is image stored left to right ? */ bool claw::graphic::targa::file_structure::header::specification:: left_right_oriented() const { return !(descriptor & 0x10); } // targa::file_structure::header::specification::left_right_oriented() /*----------------------------------------------------------------------------*/ /** * \brief Number of bits per pixel assigned to alpha chanel. */ unsigned char claw::graphic::targa::file_structure::header::specification::alpha() const { return descriptor & 0x0F; } // targa::file_structure::header::specification::alpha() //********************* targa::file_structure::footer ************************** /*----------------------------------------------------------------------------*/ const std::string claw::graphic::targa::file_structure::footer::s_signature("TRUEVISION-XFILE."); /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ claw::graphic::targa::file_structure::footer::footer() : extension_offset(0), developer_offset(0) { std::copy( s_signature.begin(), s_signature.end(), signature ); signature[s_signature.length()] = '\0'; } // targa::file_structure::footer::footer() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the data of this footer is valid. */ bool claw::graphic::targa::file_structure::footer::is_valid() const { return std::equal( s_signature.begin(), s_signature.end(), signature ) && signature[s_signature.length()] == '\0'; } // targa::file_structure::footer::is_valid() libclaw-1.7.4/claw/code/targa_reader.cpp000066400000000000000000000272101216507631600201350ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file targa_reader.cpp * \brief Implementation of the targa::reader class. * \author Julien Jorge */ #include #include //********************* targa::reader::file_input_buffer *********************** namespace claw { namespace graphic { /*------------------------------------------------------------------------*/ /** * \brief Read a pixel from the file. * * \remark This method is specialized for the pixels of type * claw::graphic::rgba_pixel_8. */ template< > rgba_pixel_8 targa::reader::file_input_buffer::get_pixel() { rgba_pixel_8 result; if ( this->remaining() < 4 ) this->read_more(4); assert( this->remaining() >= 4 ); result.components.blue = this->get_next(); result.components.green = this->get_next(); result.components.red = this->get_next(); result.components.alpha = this->get_next(); return result; } // targa::reader::file_input_buffer::get_pixel() } // namespace graphic } // namespace claw namespace claw { namespace graphic { /*------------------------------------------------------------------------*/ /** * \brief Read a pixel from the file. * * \remark This method is specialized for the pixels of type * claw::graphic::targa::reader::rgb_pixel_8. */ template< > rgba_pixel_8 targa::reader::file_input_buffer::get_pixel() { rgba_pixel_8 result; if ( this->remaining() < 3 ) this->read_more(3); assert( this->remaining() >= 3 ); result.components.blue = this->get_next(); result.components.green = this->get_next(); result.components.red = this->get_next(); result.components.alpha = std::numeric_limits::max(); return result; } // targa::reader::file_input_buffer::get_pixel() } // namespace graphic } // namespace claw namespace claw { namespace graphic { /*------------------------------------------------------------------------*/ /** * \brief Read a pixel from the file. * * \remark This method is specialized for the pixels of type * claw::graphic::targa::reader::pixel16. */ template< > rgba_pixel_8 targa::reader::file_input_buffer::get_pixel() { rgba_pixel_8 result; if ( this->remaining() < 2 ) this->read_more(2); assert( this->remaining() >= 2 ); unsigned char second_byte = this->get_next(); unsigned char first_byte = this->get_next(); unsigned char r = (first_byte & 0x7C) >> 2; unsigned char g = ((first_byte & 0x03) << 3) | ((second_byte & 0xE0) >> 5); unsigned char b = second_byte & 0x1F; result.components.blue = b * 8; result.components.green = g * 8; result.components.red = r * 8; result.components.alpha = std::numeric_limits::max(); return result; } // targa::reader::file_input_buffer::get_pixel() } // namespace graphic } // namespace claw //****************** targa::reader::mapped_file_input_buffer ******************* namespace claw { namespace graphic { /*------------------------------------------------------------------------*/ /** * \brief Read a pixel from the file. * * \remark This method is specialized for the pixels of type * claw::graphic::pixel8. */ template< > rgba_pixel_8 targa::reader::mapped_file_input_buffer::get_pixel() { if ( this->remaining() < 1 ) this->read_more(1); assert( this->remaining() >= 1 ); unsigned char index = this->get_next(); return m_palette[index]; } // targa::reader::mapped_file_input_buffer::get_pixel() } // namespace graphic } // namespace claw //****************************** targa::reader ********************************* /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image in which the data will be stored. */ claw::graphic::targa::reader::reader( image& img ) : m_image( img ) { } // targa::reader::reader() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image in which the data will be stored. * \param f The file from which we read the data. * \post img contains the data from \a f. */ claw::graphic::targa::reader::reader( image& img, std::istream& f ) : m_image( img ) { load(f); } // targa::reader::reader() /*----------------------------------------------------------------------------*/ /** * \brief Load an image from a targa file. * \param f Targa file. */ void claw::graphic::targa::reader::load( std::istream& f ) { CLAW_PRECOND( !!f ); std::istream::pos_type init_pos = f.tellg(); try { check_if_targa(f); header h; f.read( reinterpret_cast(&h), sizeof(header) ); if ( f.rdstate() == std::ios_base::goodbit ) { m_image.set_size( h.image_specification.width, h.image_specification.height ); switch(h.image_type) { case color_mapped: load_color_mapped(h, f); break; case rle_color_mapped: load_rle_color_mapped(h, f); break; case true_color: load_true_color(h, f); break; case rle_true_color: load_rle_true_color(h, f); break; default : throw claw::bad_format ( "targa::reader::targa: unsupported image type" ); } } else throw claw::bad_format ( "claw::targa::reader::targa: can't read header" ); } catch(...) { f.clear(); f.seekg( init_pos, std::ios_base::beg ); throw; } } // targa::reader::load() /*----------------------------------------------------------------------------*/ /** * \brief Check if a stream contains targa data. * \param f The stream to check. */ void claw::graphic::targa::reader::check_if_targa( std::istream& f ) const { CLAW_PRECOND( !!f ); std::istream::pos_type init_pos = f.tellg(); footer foot; f.seekg( -(std::istream::off_type)sizeof(footer), std::ios::end ); f.read( reinterpret_cast(&foot), sizeof(footer) ); f.seekg( init_pos , std::ios::beg ); if ( !foot.is_valid() ) throw CLAW_EXCEPTION( "Not a Targa file." ); } // targa::reader::check_if_targa() /*----------------------------------------------------------------------------*/ /** * \brief Load the color palette. * \param h File's header, must have been read before call. * \param f Targa file. * \param palette (out) The color palette. * \pre (h.image_type == color_mapped) || (h.image_type == rle_color_mapped) */ void claw::graphic::targa::reader::load_palette ( const header& h, std::istream& f, color_palette32& palette ) const { assert((h.image_type == color_mapped) || (h.image_type == rle_color_mapped)); switch( h.color_map_specification.entry_size ) { case 16: load_palette_content(f, palette); break; case 24: load_palette_content(f, palette); break; case 32: load_palette_content(f, palette); break; default: throw claw::bad_format ( "targa::reader::load_palette: unsupported entry size" ); } } // targa::reader::load_palette() /*----------------------------------------------------------------------------*/ /** * \brief Load a not compressed color mapped targa file. * \param h File's header, must have been read before call. * \param f Targa file. * \pre h.image_type == color_mapped */ void claw::graphic::targa::reader::load_color_mapped ( const header& h, std::istream& f ) { assert(h.image_type == color_mapped); f.seekg( h.id_length, std::ios_base::cur ); color_palette32 palette( h.color_map_specification.length ); load_palette( h, f, palette ); switch(h.image_specification.bpp) { case 8: load_color_mapped_raw(h, f, palette); break; default: throw claw::bad_format ( "targa::reader::load_color_mapped: unsupported color depth" ); } } // targa::reader::load_color_mapped() /*----------------------------------------------------------------------------*/ /** * \brief Load a RLE color mapped targa file. * \param h File's header, must have been read before call. * \param f Targa file. * \pre h.image_type == color_mapped */ void claw::graphic::targa::reader::load_rle_color_mapped ( const header& h, std::istream& f ) { assert(h.image_type == rle_color_mapped); f.seekg( h.id_length, std::ios_base::cur ); color_palette32 palette( h.color_map_specification.length ); load_palette( h, f, palette ); switch(h.image_specification.bpp) { case 8: decompress_rle_color_mapped(h, f, palette); break; default: throw claw::bad_format ( "targa::reader::load_rle_color_mapped: unsupported color depth" ); } } // targa::reader::load_color_mapped() /*----------------------------------------------------------------------------*/ /** * \brief Load a not compressed true color targa file. * \param h File's header, must have been read before call. * \param f Targa file. * \pre h.image_type == true_color */ void claw::graphic::targa::reader::load_true_color ( const header& h, std::istream& f ) { assert(h.image_type == true_color); f.seekg( h.id_length, std::ios_base::cur ); switch(h.image_specification.bpp) { case 16 : load_true_color_raw(h, f); break; case 24 : load_true_color_raw(h, f); break; case 32 : load_true_color_raw(h, f); break; default : throw claw::bad_format ( "targa::reader::load_true_color: unsupported color depth" ); } } // targa::reader::load_true_color() /*----------------------------------------------------------------------------*/ /** * \brief Load a RLE true color targa file. * \param h File's header, must have been read before call. * \param f Targa file. * \pre h.image_type == rle_true_color */ void claw::graphic::targa::reader::load_rle_true_color ( const header& h, std::istream& f ) { assert(h.image_type == rle_true_color); f.seekg( h.id_length, std::ios_base::cur ); switch(h.image_specification.bpp) { case 16 : decompress_rle_true_color(h, f); break; case 24 : decompress_rle_true_color(h, f); break; case 32 : decompress_rle_true_color(h, f); break; default : throw claw::bad_format ( "targa::reader::load_rle_true_color: unsupported color depth" ); } } // targa::reader::load_rle_true_color() libclaw-1.7.4/claw/code/targa_writer.cpp000066400000000000000000000103471216507631600202120ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file targa_writer.cpp * \brief Implementation of the targa::writer class. * \author Julien Jorge */ #include #include //********************** targa::writer::file_output_buffer ********************* namespace claw { namespace graphic { /*------------------------------------------------------------------------*/ /** * \brief Write a pixel in the stream and set its value in the good order. * \param p The pixel to write. * * \remark This method is specialized for the pixels of type * claw::graphic::rgba_pixel_32. */ template< > void targa::writer::file_output_buffer:: order_pixel_bytes( const pixel_type& p ) { m_stream << p.components.blue << p.components.green << p.components.red << p.components.alpha; } // targa::writer::file_output_buffer::order_pixel_bytes() } // namespace graphic } // namespace claw //************************** targa::writer::writer ***************************** /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image to save. */ claw::graphic::targa::writer::writer( const image& img ) : m_image(img) { } // targa::writer::writer() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image to save. * \param f The file in which we save the data. * \param rle Tell if we must encode the data. */ claw::graphic::targa::writer::writer ( const image& img, std::ostream& f, bool rle ) : m_image(img) { save(f, rle); } // targa::writer::writer() /*----------------------------------------------------------------------------*/ /** * \brief Save the content of the image in a stream. * \param os The stream in which we write. * \param rle Tell if we must encode the data. */ void claw::graphic::targa::writer::save( std::ostream& os, bool rle ) const { header h( m_image.width(), m_image.height() ); if (rle) h.image_type = rle_true_color; else h.image_type = true_color; os.write( reinterpret_cast(&h), sizeof(header) ); if (rle) save_rle_true_color(os); else save_true_color(os); footer f; os.write( reinterpret_cast(&f), sizeof(footer) ); } // targa::writer::save() /*----------------------------------------------------------------------------*/ /** * \brief Save the content of the image, without compression. * \param os The stream in which we write. */ void claw::graphic::targa::writer::save_true_color( std::ostream& os ) const { file_output_buffer output_buffer(os); for (const_iterator it=m_image.begin(); it!=m_image.end(); ++it) output_buffer.order_pixel_bytes(*it); } // targa::writer::save_true_color() /*----------------------------------------------------------------------------*/ /** * \brief Save the content of the image, with RLE compression. * \param os The stream in which we write. */ void claw::graphic::targa::writer::save_rle_true_color( std::ostream& os ) const { rle32_encoder encoder; rle32_encoder::output_buffer_type output_buffer(os); for ( unsigned int y=0; y!=m_image.height(); ++y ) encoder.encode( m_image[y].begin(), m_image[y].end(), output_buffer ); } // targa::writer::save_rle_true_color() libclaw-1.7.4/claw/code/tween/000077500000000000000000000000001216507631600161315ustar00rootroot00000000000000libclaw-1.7.4/claw/code/tween/base_tweener.cpp000066400000000000000000000064331216507631600213060ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/code/tween/base_tweener.cpp * \brief Implementation of the claw::tween::base_tweener class. * \author Julien Jorge */ #include #include /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ claw::tween::base_tweener::~base_tweener() { } // base_tweener::~base_tweener() /*----------------------------------------------------------------------------*/ /** * \brief Create a copy of this allocated with new. */ claw::tween::base_tweener* claw::tween::base_tweener::clone() const { return do_clone(); } // base_tweener::clone() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the tweener has reached his total duration. */ bool claw::tween::base_tweener::is_finished() const { return do_is_finished(); } // base_tweener::is_finished() /*----------------------------------------------------------------------------*/ /** * \brief Update the base_tweener of a given amount of time. * \param dt The duration of the update in time units since the last call. * \return The amount of extra time in dt after the end of the update. */ double claw::tween::base_tweener::update( double dt ) { CLAW_PRECOND( dt >= 0 ); const double result = do_update(dt); if ( is_finished() ) notify_finished(); CLAW_POSTCOND( result <= dt ); CLAW_POSTCOND( result >= 0 ); return result; } // base_tweener::update() /*----------------------------------------------------------------------------*/ /** * \brief Execute the callbacks notifying about the finish of the tweener. */ void claw::tween::base_tweener::on_finished( finish_callback f ) { m_on_finished.push_back(f); } // base_tweener::on_finished() /*----------------------------------------------------------------------------*/ /** * \brief Execute the callbacks notifying about the finish of the tweener. */ void claw::tween::base_tweener::notify_finished() const { // If one of the callbacks deletes the tweener, then m_on_finished will not be // available. Since we still want to execute all the callbacks, we iterate on // a copy of it. const std::list callbacks(m_on_finished); for ( std::list::const_iterator it=callbacks.begin(); it!=callbacks.end(); ++it ) (*it)(); } // base_tweener::notify_finished() libclaw-1.7.4/claw/code/tween/easing/000077500000000000000000000000001216507631600173775ustar00rootroot00000000000000libclaw-1.7.4/claw/code/tween/easing/easing_back.cpp000066400000000000000000000026101216507631600223300ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/code/tween/easing/easing_back.cpp * \brief Implementation of the claw::tween::easing_back_func function. * \author Julien Jorge */ #include /** * \brief The default function. * \param t The ratio of the date, in (0, 1), representing the total * progression of the tweener. */ double claw::tween::easing_back_func( double t ) { const double s( 1.70158 ); return t * t * ( (s+1) * t - s); } // easing_back_func() libclaw-1.7.4/claw/code/tween/easing/easing_bounce.cpp000066400000000000000000000033331216507631600227060ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/code/tween/easing/easing_bounce.cpp * \brief Implementation of the claw::tween::easing_bounce_func function. * \author Julien Jorge */ #include /** * \brief The default function. * \param t The ratio of the date, in (0, 1), representing the total * progression of the tweener. */ double claw::tween::easing_bounce_func( double t ) { const double v = 1 - t; double c; double d; if ( v < (1 / 2.75) ) { c = v; d = 0; } else if ( v < (2 / 2.75) ) { c = v - 1.5 / 2.75; d = 0.75; } else if ( v < (2.5 / 2.75) ) { c = v - 2.25 / 2.75; d = 0.9375; } else { c = v - 2.625 / 2.75; d = 0.984375; } return 1 - (7.5625 * c * c + d); } // easing_bounce_func() libclaw-1.7.4/claw/code/tween/easing/easing_circ.cpp000066400000000000000000000025531216507631600223560ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/code/tween/easing/easing_circ.cpp * \brief Implementation of the claw::tween::easing_circ_func function. * \author Julien Jorge */ #include /** * \brief The default function. * \param t The ratio of the date, in (0, 1), representing the total * progression of the tweener. */ double claw::tween::easing_circ_func( double t ) { return 1 - std::sqrt(1 - t * t); } // easing_circ_func() libclaw-1.7.4/claw/code/tween/easing/easing_cubic.cpp000066400000000000000000000025411216507631600225200ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/code/tween/easing/easing_cubic.cpp * \brief Implementation of the claw::tween::easing_cubic_func function. * \author Julien Jorge */ #include /** * \brief The default function. * \param t The ratio of the date, in (0, 1), representing the total * progression of the tweener. */ double claw::tween::easing_cubic_func( double t ) { return t * t * t; } // easing_cubic_func() libclaw-1.7.4/claw/code/tween/easing/easing_elastic.cpp000066400000000000000000000031071216507631600230560ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/code/tween/easing/easing_elastic.cpp * \brief Implementation of the claw::tween::easing_elastic_func function. * \author Julien Jorge */ #include #include #include /** * \brief The default function. * \param t The ratio of the date, in (0, 1), representing the total * progression of the tweener. */ double claw::tween::easing_elastic_func( double t ) { const double pi( boost::math::constants::pi() ); const double v(t-1); const double p(0.3); return -std::pow(2, 10 * v) * std::sin( (v - p / 4) * 2 * pi / p ); } // easing_elastic_func() libclaw-1.7.4/claw/code/tween/easing/easing_expo.cpp000066400000000000000000000026131216507631600224060ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/code/tween/easing/easing_expo.cpp * \brief Implementation of the claw::tween::easing_expo_func function. * \author Julien Jorge */ #include #include /** * \brief The default function. * \param t The ratio of the date, in (0, 1), representing the total * progression of the tweener. */ double claw::tween::easing_expo_func( double t ) { return t == 0 ? 0 : std::pow(2, 10 * (t - 1)); } // easing_expo_func() libclaw-1.7.4/claw/code/tween/easing/easing_linear.cpp000066400000000000000000000025361216507631600227110ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/code/tween/easing/easing_linear.cpp * \brief Implementation of the claw::tween::easing_linear_func function. * \author Julien Jorge */ #include /** * \brief The default function. * \param t The ratio of the date, in (0, 1), representing the total * progression of the tweener. */ double claw::tween::easing_linear_func( double t ) { return t; } // easing_linear_func() libclaw-1.7.4/claw/code/tween/easing/easing_none.cpp000066400000000000000000000042211216507631600223670ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/code/tween/easing/easing_none.cpp * \brief Implementation of the claw::tween::easing_none class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Apply the easing at the beginning of the tweener. * \param t The ratio of the date, in (0, 1), representing the total progression * of the tweener. */ double claw::tween::easing_none::ease_in( double t ) { return 0; } // easing_none::ease_in() /*----------------------------------------------------------------------------*/ /** * \brief Apply the easing at the end of the tweener. * \param t The ratio of the date, in (0, 1), representing the total progression * of the tweener. */ double claw::tween::easing_none::ease_out( double t ) { return 0; } // easing_none::ease_out() /*----------------------------------------------------------------------------*/ /** * \brief Apply the easing at the beginning and the end of the tweener. * \param t The ratio of the date, in (0, 1), representing the total progression * of the tweener. */ double claw::tween::easing_none::ease_in_out( double t ) { return 0; } // easing_none::ease_in_out() libclaw-1.7.4/claw/code/tween/easing/easing_quad.cpp000066400000000000000000000025301216507631600223630ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/code/tween/easing/easing_quad.cpp * \brief Implementation of the claw::tween::easing_quad_func function. * \author Julien Jorge */ #include /** * \brief The default function. * \param t The ratio of the date, in (0, 1), representing the total * progression of the tweener. */ double claw::tween::easing_quad_func( double t ) { return t * t; } // easing_quad_func() libclaw-1.7.4/claw/code/tween/easing/easing_quart.cpp000066400000000000000000000025451216507631600225730ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/code/tween/easing/easing_quart.cpp * \brief Implementation of the claw::tween::easing_quart_func function. * \author Julien Jorge */ #include /** * \brief The default function. * \param t The ratio of the date, in (0, 1), representing the total * progression of the tweener. */ double claw::tween::easing_quart_func( double t ) { return t * t * t * t; } // easing_quart_func() libclaw-1.7.4/claw/code/tween/easing/easing_quint.cpp000066400000000000000000000025511216507631600225740ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/code/tween/easing/easing_quint.cpp * \brief Implementation of the claw::tween::easing_quint_func function. * \author Julien Jorge */ #include /** * \brief The default function. * \param t The ratio of the date, in (0, 1), representing the total * progression of the tweener. */ double claw::tween::easing_quint_func( double t ) { return t * t * t * t * t; } // easing_quint_func() libclaw-1.7.4/claw/code/tween/easing/easing_sine.cpp000066400000000000000000000027461216507631600224000ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/code/tween/easing/easing_sine.cpp * \brief Implementation of the claw::tween::easing_sine_func function. * \author Julien Jorge */ #include #include #include /** * \brief The default function. * \param t The ratio of the date, in (0, 1), representing the total * progression of the tweener. */ double claw::tween::easing_sine_func( double t ) { const double pi( boost::math::constants::pi() ); return 1 - std::cos(t * pi / 2); } // easing_sine_func() libclaw-1.7.4/claw/code/tween/single_tweener.cpp000066400000000000000000000164661216507631600216640ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/code/tween/single_tweener.cpp * \brief Implementation of the claw::tween::single_tweener class. * \author Julien Jorge */ #include #include #include /** * \brief Swap the values of two double variables. * \param a The reference to the first value to swap. * \param b The reference to the second value to swap. * * On some configurations the compiler complains about not finding * std::swap in instructions like: * * \code boost::bind( &std::swap, boost::ref(val), _1 ); \endcode * * As it was used in * claw::tween::single_tweener::single_tweener * (double&, double, double, easing_function) * * The workaround is to use this local definition of the swap function. */ static void local_swap( double& a, double& b ) { const double t(a); a = b; b = t; } // local_swap() #ifndef CLAW_TWEENER_DEFINE_BOOST_THROW_EXCEPTION #ifndef WORKAROUND_BOOST_THROW_EXCEPTION #define WORKAROUND_BOOST_THROW_EXCEPTION #include "boost/throw_exception.hpp" /** * \brief Redefinition of some boost elements, required on some compilers. */ namespace boost { /** * \brief boost::throw_exception definition, Needed on XCode compiler. * This implementation does nothing. * \param exc The exception to throw. * * \author Anton Rutkevich */ void throw_exception( std::exception const& exc ) { // nothing } // throw_exception() } // namespace boost #endif // WORKAROUND_BOOST_THROW_EXCEPTION #endif // ifdef CLAW_TWEENER_DEFINE_BOOST_THROW_EXCEPTION /*----------------------------------------------------------------------------*/ /** * \brief Default constructor. */ claw::tween::single_tweener::single_tweener() : m_date(0), m_easing( easing_none::ease_in_out ) { } // single_tweener::single_tweener() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param init The initial value. * \param end The final value. * \param duration The total duration. * \param callback The function called when the single_tweener is updated. * \param e The function used to compute the new value. */ claw::tween::single_tweener::single_tweener ( double init, double end, double duration, update_function callback, easing_function e ) : m_init(init), m_end(end), m_date(0), m_duration(duration), m_callback(callback), m_easing(e) { } // single_tweener::single_tweener() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param val The value to tween (and to use as the The initial value). * \param end The final value. * \param duration The total duration. * \param e The function used to compute the new value. */ claw::tween::single_tweener::single_tweener ( double& val, double end, double duration, easing_function e ) : m_init(val), m_end(end), m_date(0), m_duration(duration), m_easing(e) { m_callback = boost::bind( &local_swap, boost::ref(val), _1 ); } // single_tweener::single_tweener() /*----------------------------------------------------------------------------*/ /** * \brief Gets the initial value. */ double claw::tween::single_tweener::get_init() const { return m_init; } // single_tweener::get_init() /*----------------------------------------------------------------------------*/ /** * \brief Sets the initial value. * \param v The value. */ void claw::tween::single_tweener::set_init( double v ) { m_init = v; } // single_tweener::set_init() /*----------------------------------------------------------------------------*/ /** * \brief Gets the final value. */ double claw::tween::single_tweener::get_end() const { return m_end; } // single_tweener::get_end() /*----------------------------------------------------------------------------*/ /** * \brief Sets the final value. * \param v The value. */ void claw::tween::single_tweener::set_end( double v ) { m_end = v; } // single_tweener::set_end() /*----------------------------------------------------------------------------*/ /** * \brief Gets the total duration. */ double claw::tween::single_tweener::get_duration() const { return m_duration; } // single_tweener::get_duration() /*----------------------------------------------------------------------------*/ /** * \brief Sets the total duration. * \param v The value. */ void claw::tween::single_tweener::set_duration( double v ) { m_duration = v; } // single_tweener::set_duration() /*----------------------------------------------------------------------------*/ /** * \brief The function called when the single_tweener is updated. * \param f The function. */ void claw::tween::single_tweener::set_callback( update_function f ) { m_callback = f; } // single_tweener::set_callback() /*----------------------------------------------------------------------------*/ /** * \brief The function used to compute the new value. * \param f The function. */ void claw::tween::single_tweener::set_easing( easing_function f ) { m_easing = f; } // single_tweener::set_easing() /*----------------------------------------------------------------------------*/ /** * \brief Gets the current value of the tweener. */ double claw::tween::single_tweener::get_value() const { const double coeff = m_easing( m_date / m_duration ); return m_init + coeff * (m_end - m_init); } // single_tweener::get_value() /*----------------------------------------------------------------------------*/ /** * \brief Create a copy of this allocated with new. */ claw::tween::single_tweener* claw::tween::single_tweener::do_clone() const { return new single_tweener(*this); } // single_tweener::do_clone() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the single_tweener has reached his total duration. */ bool claw::tween::single_tweener::do_is_finished() const { return m_date >= m_duration; } // single_tweener::do_is_finished() /*----------------------------------------------------------------------------*/ /** * \brief Update the single_tweener of a given amount of time. * \param dt The duration of the update in time units since the last call. */ double claw::tween::single_tweener::do_update( double dt ) { const double t( std::min(m_duration - m_date, dt) ); const double result = dt - t; m_date += t; const double val( get_value() ); m_callback(val); return result; } // single_tweener::do_update() libclaw-1.7.4/claw/code/tween/tweener.cpp000066400000000000000000000076731216507631600203230ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/code/tween/tweener.cpp * \brief Implementation of the claw::tween::tweener class. * \author Julien Jorge */ #include #include /*----------------------------------------------------------------------------*/ /** * \brief Default constructor. */ claw::tween::tweener::tweener() : m_impl(NULL) { } // tweener::tweener() /*----------------------------------------------------------------------------*/ /** * \brief Copy constructor. * \param that The instance to copy from. */ claw::tween::tweener::tweener( const tweener& that ) : m_impl( that.m_impl == NULL ? NULL : that.m_impl->clone() ) { } // tweener::tweener() /*----------------------------------------------------------------------------*/ /** * \brief Constructor from a base_tweener. * \param that The instance to use for the implementation. */ claw::tween::tweener::tweener( const base_tweener& that ) : m_impl( that.clone() ) { } // tweener::tweener() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ claw::tween::tweener::~tweener() { delete m_impl; } // tweener::~tweener() /*----------------------------------------------------------------------------*/ /** * \brief Assignment operator. * \param that The instance to copy from. */ claw::tween::tweener& claw::tween::tweener::operator=( const tweener& that ) { tweener tmp(that); swap(tmp); return *this; } // tweener::operator=() /*----------------------------------------------------------------------------*/ /** * \brief Swap this instance with a given instance. * \param that The instance to swap with. */ void claw::tween::tweener::swap( tweener& that ) throw() { std::swap(m_impl, that.m_impl); } // tweener::swap() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the tweener has reached his total duration. */ bool claw::tween::tweener::is_finished() const { if ( m_impl == NULL ) return true; else return m_impl->is_finished(); } // tweener::is_finished() /*----------------------------------------------------------------------------*/ /** * \brief Update the tweener of a given amount of time. * \param dt The duration of the update in time units since the last call. */ double claw::tween::tweener::update( double dt ) { if ( m_impl == NULL ) return dt; else return m_impl->update(dt); } // tweener::update() /*----------------------------------------------------------------------------*/ /** * \brief Execute the callbacks notifying about the finish of the tweener. */ void claw::tween::tweener::on_finished( finish_callback f ) { if ( m_impl != NULL ) m_impl->on_finished(f); } // tweener::on_finished() /*----------------------------------------------------------------------------*/ /** * \brief Swap two tweeners. * \param a The first tweener. * \param b The second tweener. */ template<> void std::swap( claw::tween::tweener& a, claw::tween::tweener& b ) { a.swap(b); } // std::swap() libclaw-1.7.4/claw/code/tween/tweener_group.cpp000066400000000000000000000061311216507631600215230ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/code/tween/tweener_group.cpp * \brief Implementation of the claw::tween::tweener_group class. * \author Julien Jorge */ #include "claw/tween/tweener_group.hpp" /*----------------------------------------------------------------------------*/ /** * \brief Add a tweener in the group. * \param t The tweener. */ void claw::tween::tweener_group::insert( const tweener& t ) { m_tweeners.push_back(t); } // tweener_group::insert() /*----------------------------------------------------------------------------*/ /** * \brief Remove all the tweeners from the group. */ void claw::tween::tweener_group::clear() { m_tweeners.clear(); } // tweener_group::clear() /*----------------------------------------------------------------------------*/ /** * \brief Create a copy of this, allocated with new. */ claw::tween::tweener_group* claw::tween::tweener_group::do_clone() const { return new tweener_group(*this); } // tweener_group::do_clone() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the tweener has reached his total duration. */ bool claw::tween::tweener_group::do_is_finished() const { return m_tweeners.empty(); } // tweener_group::do_is_finished() /*----------------------------------------------------------------------------*/ /** * \brief Update the tweeners by a given amount of time. * \param dt The duration of the update in time units since the last call. */ double claw::tween::tweener_group::do_update( double dt ) { typedef std::list::iterator iterator_type; double result(dt); iterator_type it = m_tweeners.begin(); while ( it != m_tweeners.end() ) { const double r = it->update(dt); result = std::min(result, r); if ( it->is_finished() ) { const iterator_type tmp(it); ++it; m_tweeners.erase(tmp); } else ++it; } return result; } // tweener_group::do_update() /*----------------------------------------------------------------------------*/ /** * \brief Tells if there is nothing in this group. */ bool claw::tween::tweener_group::empty() const { return m_tweeners.empty(); } // tweener_group::empty() libclaw-1.7.4/claw/code/tween/tweener_sequence.cpp000066400000000000000000000057251216507631600222070ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/code/tween/tweener_sequence.cpp * \brief Implementation of the claw::tween::tweener_sequence class. * \author Julien Jorge */ #include "claw/tween/tweener_sequence.hpp" /*----------------------------------------------------------------------------*/ /** * \brief Add a tweener in the sequence. * \param t The tweener. */ void claw::tween::tweener_sequence::insert( const tweener& t ) { m_tweeners.push_back(t); } // tweener_sequence::insert() /*----------------------------------------------------------------------------*/ /** * \brief Remove all the tweeners from the sequence. */ void claw::tween::tweener_sequence::clear() { m_tweeners.clear(); } // tweener_sequence::clear() /*----------------------------------------------------------------------------*/ /** * \brief Create a copy of this, allocated with new. */ claw::tween::tweener_sequence* claw::tween::tweener_sequence::do_clone() const { return new tweener_sequence(*this); } // tweener_sequence::do_clone() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the tweener has reached his total duration. */ bool claw::tween::tweener_sequence::do_is_finished() const { return m_tweeners.empty(); } // tweener_sequence::do_is_finished() /*----------------------------------------------------------------------------*/ /** * \brief Update the tweeners by a given amount of time. * \param dt The duration of the update in time units since the last call. */ double claw::tween::tweener_sequence::do_update( double dt ) { double result(dt); while ( (result != 0) && !m_tweeners.empty() ) { result = m_tweeners.front().update(result); if ( m_tweeners.front().is_finished() ) m_tweeners.pop_front(); } return result; } // tweener_sequence::do_update() /*----------------------------------------------------------------------------*/ /** * \brief Tells if there is nothing in this sequence. */ bool claw::tween::tweener_sequence::empty() const { return m_tweeners.empty(); } // tweener_sequence::empty() libclaw-1.7.4/claw/code/xbm.cpp000066400000000000000000000057721216507631600163140ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file xbm.cpp * \brief Implementation of the claw::graphic::xbm class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. Creates an empty image. * \param w Image's width. * \param h Image's height. * \pre w > 0 and h > 0 */ claw::graphic::xbm::xbm( unsigned int w, unsigned int h ) : image(w, h), m_hot(NULL) { } // xbm::xbm() [constructor] /*----------------------------------------------------------------------------*/ /** * \brief Copy constructor. * \param that Image to copy from. */ claw::graphic::xbm::xbm( const image& that ) : image(that), m_hot(NULL) { } // xbm::xbm() [copy constructor] /*----------------------------------------------------------------------------*/ /** * \brief Constructor. Load an image from a xbm file. * \param f Xbm file. */ claw::graphic::xbm::xbm( std::istream& f ) : m_hot(NULL) { reader(*this, f); } // xbm::xbm() [constructor, from file] /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ claw::graphic::xbm::~xbm() { if (m_hot != NULL) delete m_hot; } // xbm::~xbm() /*----------------------------------------------------------------------------*/ /** * \brief Save the image. * \param f The file in which we write. */ void claw::graphic::xbm::save( std::ostream& f ) const { writer( *this, f, writer::options( m_name, m_hot ) ); } // xbm::save() /*----------------------------------------------------------------------------*/ /** * \brief Set the name of the image. * \param name The name of the image; */ void claw::graphic::xbm::set_name( const std::string& name ) { m_name = name; } // xbm::set_name() /*----------------------------------------------------------------------------*/ /** * \brief Set the hot spot of the image. * \param hot The hot spot of the image; */ void claw::graphic::xbm::set_hot( const claw::math::coordinate_2d& hot ) { if (m_hot != NULL) delete m_hot; m_hot = new claw::math::coordinate_2d(hot); } // xbm::set_hot() libclaw-1.7.4/claw/code/xbm_reader.cpp000066400000000000000000000245551216507631600176360ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file xbm_reader.cpp * \brief Implementation of the claw::graphic::xbm::reader class. * \author Julien Jorge */ #include #include #include #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image in which the data will be stored. */ claw::graphic::xbm::reader::reader( image& img ) : m_image( img ), m_hot(NULL) { } // xbm::reader::reader() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image in which the data will be stored. * \param f The file from which we read the data. * \post img contains the data from \a f. */ claw::graphic::xbm::reader::reader( image& img, std::istream& f ) : m_image( img ), m_hot(NULL) { load(f); } // xbm::reader::reader() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image in which the data will be stored. * \param f The file from which we read the data. * \post img contains the data from \a f. */ claw::graphic::xbm::reader::reader( xbm& img, std::istream& f ) : m_image( img ), m_hot(NULL) { load(f); img.set_name( m_name ); if (m_hot != NULL) img.set_hot( *m_hot ); } // xbm::reader::reader() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ claw::graphic::xbm::reader::~reader() { if (m_hot != NULL) { delete m_hot; m_hot = NULL; } } // xbm::reader::~reader() /*----------------------------------------------------------------------------*/ /** * \brief Load an image from a xbm file. * \param f XBM file. */ void claw::graphic::xbm::reader::load( std::istream& f ) { CLAW_PRECOND( !!f ); std::istream::pos_type init_pos = f.tellg(); if (m_hot != NULL) { delete m_hot; m_hot = NULL; } try { read_from_file(f); } catch(...) { if (m_hot != NULL) delete m_hot; f.clear(); f.seekg( init_pos, std::ios_base::beg ); throw; } } // xbm::reader::load() /*----------------------------------------------------------------------------*/ /** * \brief Load an image from a xbm file. * \param f XBM file. */ void claw::graphic::xbm::reader::read_from_file( std::istream& f ) { std::string line; bool valid_format = false; unsigned int bpe; read_size(f); bpe = read_bits_per_entry(f); read_name(f); read_line( f, line, '{' ); if ( !line.empty() ) { read_pixels(f, bpe); read_line(f, line, ';'); valid_format = true; } if ( !valid_format ) throw claw::exception( "Not an XBM file." ); } // xbm::reader::read_from_file() /*----------------------------------------------------------------------------*/ /** * \brief Read the size of the image. * \param f The stream in which we read the field. */ void claw::graphic::xbm::reader::read_size( std::istream& f ) { unsigned int w(0), h(0); bool valid = true; bool stop = false; std::string line; while ( valid && !stop ) { std::ios::pos_type pos = f.tellg(); read_line( f, line, '\n' ); if ( !line.empty() ) { if ( line.find("width") != std::string::npos ) w = read_dim(line); else if ( line.find("height") != std::string::npos ) h = read_dim(line); else if ( line.find("x_hot") != std::string::npos ) { if ( m_hot == NULL ) m_hot = new claw::math::coordinate_2d; m_hot->x = read_dim(line); } else if ( line.find("y_hot") != std::string::npos ) { if ( m_hot == NULL ) m_hot = new claw::math::coordinate_2d; m_hot->y = read_dim(line); } else if ( line.find("static") != std::string::npos ) { stop = true; f.seekg( pos ); } } else valid = false; } if ( valid ) m_image.set_size(w, h); else throw claw::exception( "Not an XBM file." ); } // xbm::reader::read_size() /*----------------------------------------------------------------------------*/ /** * \brief Read the width or height of the image. * \param line The line in which we read the field. */ unsigned int claw::graphic::xbm::reader::read_dim( const std::string& line ) const { unsigned int result; std::istringstream iss(line); std::string token; bool valid = false; if (iss >> token) if ( token == "#define" ) if ( iss >> token ) if ( iss >> result ) valid = true; if ( !valid ) throw claw::exception( "Not an XBM file." ); return result; } // xbm::reader::read_dim() /*----------------------------------------------------------------------------*/ /** * \brief Read the number of bits per entry. * \param f The stream in which we read the field. */ unsigned int claw::graphic::xbm::reader::read_bits_per_entry( std::istream& f ) const { std::string line; unsigned int result(0); std::string token; if ( f >> token ) if ( token == "static" ) if ( f >> token ) { if ( token == "unsigned" ) f >> token; else if ( token == "signed" ) f >> token; if ( token == "char" ) result = sizeof(char) * 8; else if ( token == "short" ) result = sizeof(short) * 8; else if ( token == "int" ) result = sizeof(int) * 8; else if ( token == "long" ) result = sizeof(long) * 8; } if ( result == 0 ) throw claw::exception( "Not an XBM file." ); return result; } // xbm::reader::read_bits_per_entry() /*----------------------------------------------------------------------------*/ /** * \brief Read the name of the image. * \param f The stream in which we read the field. */ void claw::graphic::xbm::reader::read_name( std::istream& f ) { bool valid = false; std::string line; read_line(f, line, '['); if ( !line.empty() ) { std::string::size_type end = line.find_last_of('_'); if ( end != std::string::npos ) { std::string::size_type begin = line.find_last_of(" \t", end); if ( begin == std::string::npos ) begin = 0; m_name = line.substr(begin, end - begin); valid = true; } } if ( !valid ) throw claw::exception( "Not an XBM file." ); } // xbm::reader::read_name() /*----------------------------------------------------------------------------*/ /** * \brief Read the pixels of the image. * \param f The stream in which we search the next line. * \param bpe Number of bits per entry. */ void claw::graphic::xbm::reader::read_pixels ( std::istream& f, unsigned int bpe ) const { image::iterator first = m_image.begin(); const image::iterator last = m_image.end(); bool valid = true; unsigned int x = 0; while ( (first!=last) && valid ) { std::string s_val; read_line( f, s_val, ',' ); std::istringstream iss(s_val); long int val; if ( iss >> std::hex >> val ) { for( unsigned int i=0; (i!=bpe) && (first!=last) && (x!=m_image.width()); ++i, ++first, ++x, val >>= 1 ) if ( val & 1 ) *first = black_pixel; else *first = white_pixel; if ( x==m_image.width() ) x = 0; } else valid = false; } if ( !valid ) throw claw::exception( "Not an XBM file." ); } // xbm::reader::read_pixels() /*----------------------------------------------------------------------------*/ /** * \brief Read the next not commented line, and remove any comments from it. * \param f The stream in which we search the next line. * \param line The line in which we read the field. * \param endchar The character used to end the line. */ void claw::graphic::xbm::reader::read_line ( std::istream& f, std::string& line, char endchar ) const { bool stop = false; line.clear(); while ( !stop ) if ( std::getline( f, line, endchar ) ) { text::trim(line); remove_comments(f, line, endchar); stop = !line.empty(); } else stop = true; } // xbm::reader::read_line() /*----------------------------------------------------------------------------*/ /** * \brief Remove the comments from a line. * \param f If the line contains the begining of a multi line comment, we search * the next line from this stream. * \param line The line in which we read the field. * \param endchar The character used to end the line. */ void claw::graphic::xbm::reader::remove_comments ( std::istream& f, std::string& line, char endchar ) const { std::string working(line); std::string::size_type beg = working.find( "/*" ); if ( beg != std::string::npos ) { line = working.substr(0, beg); std::string::size_type end = working.rfind( "*/" ); bool stop = false; while ( (end == std::string::npos) && !stop ) if ( std::getline(f, working, endchar) ) end = working.find( "*/" ); else stop = true; if ( !stop ) { line += working.substr(end+2, line.length() - end - 2); text::trim(line); } if ( !line.empty() ) remove_comments(f, line, endchar); } } // xbm::reader::remove_comments() libclaw-1.7.4/claw/code/xbm_writer.cpp000066400000000000000000000104331216507631600176760ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file xbm_writer.cpp * \brief Implementation of the claw::graphic::xbm::writer class. * \author Julien Jorge */ #include #include /*----------------------------------------------------------------------------*/ /** * \brief Default constructor. */ claw::graphic::xbm::writer::options::options() : name("noname"), hot(NULL) { } // xbm::writer::options::options() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param n The name of the image structure in the file. * \param h The position of the hot spot in the image. */ claw::graphic::xbm::writer::options::options ( const std::string& n, const claw::math::coordinate_2d* h ) : name(n), hot(h) { } // xbm::writer::options::options() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image in which the data will be stored. */ claw::graphic::xbm::writer::writer( const image& img ) : m_image( img ) { } // xbm::writer::writer() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The image to save. * \param f The file in which we write the data. * \param opt Saving options. */ claw::graphic::xbm::writer::writer ( const image& img, std::ostream& f, const options& opt ) : m_image( img ) { save(f, opt); } // xbm::writer::writer() /*----------------------------------------------------------------------------*/ /** * \brief Save the image in a XBM file. * \param f XBM file. * \param opt Saving options. */ void claw::graphic::xbm::writer::save( std::ostream& f, const options& opt ) const { CLAW_PRECOND( !!f ); f << "#define " << opt.name << "_width " << m_image.width() << "\n"; f << "#define " << opt.name << "_height " << m_image.height() << "\n"; if ( opt.hot != NULL ) { f << "#define " << opt.name << "_x_hot " << opt.hot->x << "\n"; f << "#define " << opt.name << "_y_hot " << opt.hot->y << "\n"; } f << "static unsigned char " << opt.name << "_bits[] = {\n "; save_bits(f); } // xbm::writer::save() /*----------------------------------------------------------------------------*/ /** * \brief Save the pixels of the image in a XBM file. * \param f XBM file. */ void claw::graphic::xbm::writer::save_bits( std::ostream& f ) const { const unsigned int max_per_line = (80 - 1) / 6; const unsigned int nb_pxl = m_image.width() * m_image.height(); unsigned int pxl_count = 0; unsigned int per_line = 0; for (unsigned int y=0; y!=m_image.height(); ++y) { unsigned int x=0; while ( x!=m_image.width() ) { unsigned int v(0); unsigned int bits; for ( bits=0; (x!=m_image.width()) && (bits != 8); ++bits, ++x, ++pxl_count ) { v >>= 1; if ( m_image[y][x].luminosity() <= 127 ) v |= 0x80; } v >>= 8 - bits; ++per_line; f << " 0x" << std::setw(2) << std::setfill('0') << std::hex << v; if ( pxl_count != nb_pxl ) { f << ","; if ( per_line == max_per_line ) { f << "\n "; per_line = 0; } } } } f << "};" << std::endl; } // xbm::writer::save() libclaw-1.7.4/claw/color_palette.hpp000066400000000000000000000036771216507631600174570ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file color_palette.hpp * \brief A palette of color, for palettized images. * \author Julien Jorge */ #ifndef __CLAW_GRAPHIC_COLOR_PALETTE_HPP__ #define __CLAW_GRAPHIC_COLOR_PALETTE_HPP__ #include namespace claw { namespace graphic { /** * \brief A palette of colors, for palettized images. * \author Julien Jorge */ template< typename Color > class color_palette { public: /** \brief The type of the colors stored in the palette. */ typedef Color color_type; public: color_palette(unsigned int n); unsigned int size() const; color_type& operator[]( unsigned int i ); const color_type& operator[]( unsigned int i ) const; const color_type& operator()( unsigned int i ) const; private: /** \brief The colors in the palette. */ std::vector m_palette; }; // class color_palette } // namespace graphic } // namespace claw #include #endif // __CLAW_GRAPHIC_COLOR_PALETTE_HPP__ libclaw-1.7.4/claw/configuration_file.hpp000066400000000000000000000167031216507631600204630ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file configuration_file.hpp * \brief A class to get the content of a configuration file. * \author Julien Jorge. */ #ifndef __CLAW_CONFIGURATION_FILE_HPP__ #define __CLAW_CONFIGURATION_FILE_HPP__ #include #include #include #include #include namespace claw { /** * \brief A class to get the content of a configuration file. * \author Julien Jorge. */ class configuration_file { public: /** \brief This class tells us how to parse the input file. */ struct syntax_description { public: /** \brief Two symbols making a pair (like () or []). */ typedef std::pair paired_symbol; public: syntax_description(); std::string make_comment( const std::string& value ) const; std::string make_assignment ( const std::string& key, const std::string& value ) const; std::string make_section_name( const std::string& name ) const; public: /** \brief Symbol used to comment the rest of the line. */ char comment; /** \brief Symbol used to assign a value to a field. */ char assignment; /** \brief Pair of symbols around a section name. */ paired_symbol section_name; }; // struct syntax_descritpion private: /** \brief The content of a section. */ typedef std::multimap section_content; /** \brief The sections in the file. */ typedef std::map file_content; /** \brief Pointer to a section_content. */ typedef section_content* section_content_ptr; public: /** \brief Iterator on the name of the sections. */ typedef claw::wrapped_iterator < const file_content::key_type, file_content::const_iterator, const_pair_first >::iterator_type const_file_iterator; /** \brief Iterator on the fields of a section. */ typedef claw::wrapped_iterator < const section_content::key_type, section_content::const_iterator, const_pair_first >::iterator_type const_section_iterator; /** * \brief This class is an iterator on the values set for a same field name. */ class const_field_iterator { private: /** \brief Iterator on the fields. */ typedef section_content::const_iterator wrapped_iterator_type; public: typedef std::string value_type; typedef const value_type& reference; typedef const value_type* pointer; typedef wrapped_iterator_type::difference_type difference_type; typedef wrapped_iterator_type::iterator_category iterator_category; public: const_field_iterator() {} const_field_iterator( wrapped_iterator_type it ) : m_iterator(it) {} bool operator==( const const_field_iterator& that ) const { return m_iterator == that.m_iterator; } // operator==() bool operator!=( const const_field_iterator& that ) const { return m_iterator != that.m_iterator; } // operator!=() const_field_iterator& operator++() { ++m_iterator; return *this; } // operator++() const_field_iterator operator++(int) { const_field_iterator tmp(*this); ++m_iterator; return tmp; } // operator++() [post] const_field_iterator& operator--() { --m_iterator; return *this; } // operator--() const_field_iterator operator--(int) { const_field_iterator tmp(*this); --m_iterator; return tmp; } // operator--() [post] reference operator*() const { return m_iterator->second; } // operator*() pointer operator->() const { return &m_iterator->second; } // operator->() private: /** \brief Iterator on a section content. */ wrapped_iterator_type m_iterator; }; // class const_field_iterator public: configuration_file(); configuration_file (std::istream& is, const syntax_description& syntax = syntax_description()); bool open (std::istream& is, const syntax_description& syntax = syntax_description()); void save (std::ostream& os, const syntax_description& syntax = syntax_description()); const std::string& operator()( const std::string& section, const std::string& field ) const; const std::string& operator()( const std::string& field ) const; bool has_field ( const std::string& section, const std::string& field ) const; bool has_field( const std::string& field ) const; void set_value ( const std::string& section, const std::string& field, const std::string& val ); void set_value( const std::string& field, const std::string& val ); void add_value ( const std::string& section, const std::string& field, const std::string& val ); void add_value( const std::string& field, const std::string& val ); void clear_section( const std::string& section ); const_field_iterator field_begin( const std::string& section, const std::string& field ) const; const_field_iterator field_end( const std::string& section, const std::string& field ) const; const_field_iterator field_begin( const std::string& field ) const; const_field_iterator field_end( const std::string& field ) const; const_section_iterator section_begin() const; const_section_iterator section_end() const; const_section_iterator section_begin( const std::string& section ) const; const_section_iterator section_end( const std::string& section ) const; const_file_iterator file_begin() const; const_file_iterator file_end() const; private: bool get_line( std::istream& is, const syntax_description& syntax, std::string& line ) const; bool process_line( const std::string& line, const syntax_description& syntax, section_content_ptr& section ); void escape_line( std::istream& is, const syntax_description& syntax, std::string& line ) const; void escape_char ( char escaped, const syntax_description& syntax, std::string& str ) const; void save_section_content ( const section_content& c, std::ostream& os, const syntax_description& syntax ) const; private: /** \brief The fields set outside a section. */ section_content m_noname_section; /** \brief All the sections and their content. */ file_content m_sections; /** \brief String returned when asking for a not filled field. */ static const std::string s_unknow_field_value; }; // class configuration_file } // namespace claw #endif // __CLAW_CONFIGURATION_FILE_HPP__ libclaw-1.7.4/claw/coordinate_2d.hpp000066400000000000000000000056731216507631600173350ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file coordinate_2d.hpp * \brief Coordinates in a two dimensional space. * \author Julien Jorge */ #ifndef __CLAW_COORDINATE_2D_HPP__ #define __CLAW_COORDINATE_2D_HPP__ namespace claw { namespace math { /** * \brief Coordinates in a two dimensional space. * \author Julien Jorge */ template class coordinate_2d { public: /** \brief The type of the values we store. */ typedef T value_type; /** \brief The type of the current class. */ typedef coordinate_2d self_type; public: coordinate_2d(); template coordinate_2d( const coordinate_2d& that ); coordinate_2d( const value_type& _x, const value_type& _y ); template coordinate_2d cast_value_type_to() const; void set(const value_type& _x, const value_type& _y); value_type distance(const self_type& p) const; void rotate( const self_type& center, double angle ); double slope_angle( const self_type& to ) const; bool operator==(const self_type& vect) const; bool operator!=(const self_type& vect) const; self_type operator+(const self_type& vect) const; self_type operator-(const self_type& vect) const; self_type& operator+=(const self_type& vect); self_type& operator-=(const self_type& vect); self_type operator*( const value_type& v ) const; self_type operator/( const value_type& v ) const; self_type& operator*=( const value_type& v ); self_type& operator/=( const value_type& v ); public: /** \brief X-coordinate. */ value_type x; /** \brief Y-coordinate. */ value_type y; }; // class coordinate_2d template coordinate_2d operator-( const coordinate_2d& that ); template coordinate_2d operator*( U v, const coordinate_2d& self ); } // namespace math } // namespace claw #include #endif // __CLAW_COORDINATE_2D_HPP__ libclaw-1.7.4/claw/coordinate_traits.hpp000066400000000000000000000106341216507631600203270ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/coordinate_traits.hpp * \brief The coordinate traits provide an access to the members of the * structures representing a coordinate in a 2D space. * \author Julien Jorge */ #ifndef __CLAW_MATH_COORDINATE_TRAITS_HPP__ #define __CLAW_MATH_COORDINATE_TRAITS_HPP__ #include #include namespace claw { namespace math { /** * \brief The coordinate traits provide an access to the members of the * structures representing a coordinate in a 2D space. * * \author Julien Jorge */ template< typename C > struct coordinate_traits; /** * \brief Specialization of the coordinate_traits for * claw::math::coordinate_2d. * \author Julien Jorge */ template struct coordinate_traits< claw::math::coordinate_2d > { /** \brief The type of the coordinate. */ typedef claw::math::coordinate_2d coordinate_type; /** \brief The type of the components of the coordinate. */ typedef typename coordinate_type::value_type value_type; /** * \brief Get the component of a coordinate on the x-axis. * \param c The coordinate from which the component is taken. */ static value_type get_x( const coordinate_type& c ) { return c.x; } // get_x() /** * \brief Get the component of a coordinate on the y-axis. * \param c The coordinate from which the component is taken. */ static value_type get_y( const coordinate_type& c ) { return c.y; } // get_y() /** * \brief Create a new coordinate from with the components sets to the * provided values. * \param x The position on the x axis. * \param y The position on the y axis. */ static coordinate_type make_coordinate( value_type x, value_type y ) { return coordinate_type(x, y); } // make_coordinate() }; // struct coordinate_traits [claw::math::coordinate_2d] /** * \brief Specialization of the coordinate_traits for * claw::math::vector_2d. * \author Julien Jorge */ template struct coordinate_traits< claw::math::vector_2d > { /** \brief The type of the coordinate. */ typedef claw::math::vector_2d coordinate_type; /** \brief The type of the components of the coordinate. */ typedef typename coordinate_type::value_type value_type; /** * \brief Get the component of a coordinate on the x-axis. * \param c The coordinate from which the component is taken. */ static value_type get_x( const coordinate_type& c ) { return c.x; } // get_x() /** * \brief Get the component of a coordinate on the y-axis. * \param c The coordinate from which the component is taken. */ static value_type get_y( const coordinate_type& c ) { return c.y; } // get_y() /** * \brief Create a new coordinate from with the components sets to the * provided values. * \param x The position on the x axis. * \param y The position on the y axis. */ static coordinate_type make_coordinate( value_type x, value_type y ) { return coordinate_type(x, y); } // make_coordinate() }; // struct coordinate_traits [claw::math::vector_2d] } // namespace math } // namespace claw #endif // __CLAW_MATH_COORDINATE_TRAITS_HPP__ libclaw-1.7.4/claw/curve.hpp000066400000000000000000000170721216507631600157410ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/curve.hpp * \brief Claw's implementation of Bézier curves. * \author Julien Jorge */ #ifndef __CLAW_MATH_CURVE_HPP__ #define __CLAW_MATH_CURVE_HPP__ #include #include #include namespace claw { namespace math { /** * \brief Implementation of the Bézier curve. * * The curve is made of a sequence of points, each of which having a * direction telling how the curve enters the point and how to leave. * * \author Julien Jorge */ template< typename C, typename Traits = coordinate_traits > class curve { public: /** \brief The type of the coordinates of the curve. */ typedef C coordinate_type; /** \brief The traits provide an access to the properties of the coordinates. */ typedef Traits traits_type; /** \brief The type of the components of the coordinates. */ typedef typename traits_type::value_type value_type; /** * \brief The control_point class describes a control point of the curve, * with the direction of the curve before and after the point. * \author Julien Jorge */ class control_point { public: /** \brief The type of the coordinates of the curve. */ typedef C coordinate_type; public: control_point(); explicit control_point( const coordinate_type& p ); control_point ( const coordinate_type& p, const coordinate_type& input_direction, const coordinate_type& output_direction ); const coordinate_type& get_position() const; const coordinate_type& get_input_direction() const; const coordinate_type& get_output_direction() const; private: /** \brief The position of this control point in the space. */ coordinate_type m_position; /** \brief The point giving the direction of the curve before this control point. */ coordinate_type m_input_direction; /** \brief The point giving the direction of the curve after this control point. */ coordinate_type m_output_direction; }; // class control_point private: /** \brief The type of the container in which the control points are stored. */ typedef std::list control_point_list; public: /** \brief The type of the iterator on the control points of the curve. */ typedef typename control_point_list::iterator iterator; /** \brief The type of the iterator on the control points of the curve. */ typedef typename control_point_list::const_iterator const_iterator; /** * \brief A section is a part of the curve between two control points. * \author Julien Jorge */ class section { public: /** \brief The type of the coordinates of the curve. */ typedef C coordinate_type; /** \brief The traits provide an access to the properties of the coordinates. */ typedef Traits traits_type; /** \brief The type of the components of the coordinates. */ typedef typename traits_type::value_type value_type; /** \brief The type of the iterators on the ends of the section. */ typedef const_iterator iterator_type; /** * \brief The resolved point class is a point found on a section. * \author Julien Jorge */ class resolved_point { public: /** \brief The type of the coordinates of the curve. */ typedef C coordinate_type; public: resolved_point ( const coordinate_type& position, const section& s, const double t ); const coordinate_type& get_position() const; const section& get_section() const; double get_date() const; private: /** \brief The coordinates of the point. */ coordinate_type m_position; /** \brief The section on which the point is. */ section m_section; /** \brief The date at which the point is on the section. */ double m_date; }; // class resolved_point public: section( const iterator_type& origin, const iterator_type& end ); coordinate_type get_point_at( double t ) const; coordinate_type get_tangent_at( double t ) const; std::vector get_point_at_x( value_type x, bool off_domain = false ) const; const iterator_type& get_origin() const; bool empty() const; private: value_type evaluate ( double t, value_type origin, value_type output_direction, value_type input_direction, value_type end ) const; value_type evaluate_derived ( double t, value_type origin, value_type output_direction, value_type input_direction, value_type end ) const; void ensure_ends_in_points ( std::vector& p, bool ensure_origin, bool ensure_end ) const; std::vector extract_domain_points( const std::vector& p ) const; std::vector get_roots ( value_type x, value_type origin, value_type output_direction, value_type input_direction, value_type end ) const; std::vector get_roots_degree_2 ( value_type a, value_type b, value_type c ) const; std::vector get_roots_degree_3 ( value_type a, value_type b, value_type c, value_type d ) const; private: /** \brief The point at the beginning of the section. */ iterator_type m_origin; /** \brief The point at the end of the section. */ iterator_type m_end; }; // class section public: void push_back( const control_point& p ); void push_front( const control_point& p ); void insert( const iterator& pos, const control_point& p ); section get_section( const const_iterator& pos ) const; std::vector get_point_at_x( value_type x, bool off_domain = false ) const; iterator begin(); iterator end(); const_iterator begin() const; const_iterator end() const; private: std::vector get_point_at_x_before_origin( value_type x ) const; std::vector get_point_at_x_after_end( value_type x ) const; private: /** \brief The points of this curve. */ control_point_list m_points; }; // class curve } // namespace math } // namespace claw #include "claw/impl/curve.tpp" #endif // __CLAW_MATH_CURVE_HPP__ libclaw-1.7.4/claw/dynamic_library.hpp000066400000000000000000000033361216507631600177630ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file dynamic_library.hpp * \brief A class to use dynamic libraries. * \author Julien Jorge */ #ifndef __CLAW_DYNAMIC_LIBRARY_HPP__ #define __CLAW_DYNAMIC_LIBRARY_HPP__ #include namespace claw { /** * \brief A class to use dynamic libraries. * \author Julien Jorge */ class dynamic_library { public: dynamic_library( const std::string& name, bool current_program = false ); ~dynamic_library(); bool have_symbol( const std::string& name ) const; template T get_symbol( const std::string& name ) const; private: /** \brief Handle of the library. */ dynamic_library_traits::handle m_handle; }; // class dynamic_library } // namespace claw #include #endif // __CLAW_DYNAMIC_LIBRARY_HPP__ libclaw-1.7.4/claw/dynamic_library_traits.hpp000066400000000000000000000050251216507631600213460ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file dynamic_library_traits.hpp * \brief Include the good interface for dynamic libraries for your system. * \author Julien Jorge */ #ifndef __CLAW_DYNAMIC_LIBRARY_TRAITS_HPP__ #define __CLAW_DYNAMIC_LIBRARY_TRAITS_HPP__ /** * \class claw::dynamic_library_traits * * \brief Common interface for platform specific methods needed for using * dynamic library. * * The claw::dynamic_library_traits implements platform specific methods for * dynamic library usage through a common interface. This interface must * include : * - a type named \c handle, representing the system handle to a library, * - a method handle open(std::string) for opening a library. This * method can throw an exception if a problem occurs, * - a method handle auto_open(std::string) for opening the current * program. the string will be the name (path) of the current program. This * method can throw an exception if a problem occurs, * - a method void close(handle) for closing a library, * - a method implementation_defined_pointer * get_symbol(handle, std::string) for getting a pointer to a symbol of * the library, * - a methof bool have_symbol(handle, std::string) saying if a * library has a specific symbol, * - a method bool valid_handle(handle) which tell if an handle * represent a valid handle. * * All these methods must be defined as static . */ #ifdef _WIN32 #include #else #include #endif #endif // __CLAW_DYNAMIC_LIBRARY_TRAITS_HPP__ libclaw-1.7.4/claw/dynamic_library_traits_unix.hpp000066400000000000000000000103151216507631600224070ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file dynamic_library_traits_unix.hpp * \brief Unix interface for using dynamic libraries. * \author Julien Jorge */ #ifndef __CLAW_DYNAMIC_LIBRARY_TRAITS_UNIX_HPP__ #define __CLAW_DYNAMIC_LIBRARY_TRAITS_UNIX_HPP__ #include #include #include namespace claw { /** * \brief Unix interface for using dynamic libraries. * \author Julien Jorge */ class dynamic_library_traits_unix { public: /** \brief Type of the system handle to the library. */ typedef void* handle; public: /*------------------------------------------------------------------------*/ /** * \brief Open a library. * \param name The name of the library to open. * \return The handle on the loaded library. */ static handle open( const std::string& name ) { handle h = dlopen( name.c_str(), RTLD_LAZY ); if ( !valid_handle(h) ) throw claw::exception( dlerror() ); return h; } // dynamic_library_traits_unix::open() /*------------------------------------------------------------------------*/ /** * \brief Open the current program. * \param name (not used) The name of the current program. * \return The handle on the loaded library. */ static handle auto_open( const std::string& name ) { handle h = dlopen( NULL, RTLD_LAZY ); if ( !valid_handle(h) ) throw claw::exception( dlerror() ); return h; } // dynamic_library_traits_unix::auto_open() /*------------------------------------------------------------------------*/ /** * \brief Close a library. * \param h The handle of the library to close. */ static void close( handle h ) { dlclose(h); } // dynamic_library_traits_unix::close() /*------------------------------------------------------------------------*/ /** * \brief Get a symbol from a library. * \param h Handle of the library. * \param name The name of the symbol to load. */ template static T get_symbol( handle h, const std::string& name ) { /* HACK : ISO standard doesn't allow to cast from a pointer to an object to a pointer to a function. */ T result; *(void**)(&result) = dlsym( h, name.c_str() ); return result; } // dynamic_library_traits_unix::get_symbol() /*------------------------------------------------------------------------*/ /** * \brief Tell if a symbol is in the library. * \param h Handle of the library. * \param name The name of the symbol to find. */ static bool have_symbol( handle h, const std::string& name ) { return dlsym( h, name.c_str() ) != NULL; } // dynamic_library_traits_unix::have_symbol() /*------------------------------------------------------------------------*/ /** * \brief Tell if an handle is a valid library handle. * \param h The handle to test. */ static bool valid_handle( handle h ) { return h != NULL; } // dynamic_library_traits_unix::valid_handle() }; // class dynamic_library_traits_unix /** \brief The traits to access the dynamic libraries in Unix system. */ typedef dynamic_library_traits_unix dynamic_library_traits; } // namespace claw #endif // __CLAW_DYNAMIC_LIBRARY_TRAITS_UNIX_HPP__ libclaw-1.7.4/claw/dynamic_library_traits_win32.hpp000066400000000000000000000100311216507631600223610ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file dynamic_library_traits_win32.hpp * \brief Microsoft Windows interface for using dynamic libraries. * \author Julien Jorge */ #ifndef __CLAW_DYNAMIC_LIBRARY_TRAITS_WIN32_HPP__ #define __CLAW_DYNAMIC_LIBRARY_TRAITS_WIN32_HPP__ #include //#include //#include //#include #include namespace claw { /** * \brief Microsoft Windows interface for using dynamic libraries. * \author Julien Jorge */ class dynamic_library_traits_win32 { public: /** \brief Type of the system handle to the library. */ typedef HMODULE handle; public: /*------------------------------------------------------------------------*/ /** * \brief Open a library. * \param name The name of the library to open. * \return The handle on the loaded library. */ static handle open( const std::string& name ) { return LoadLibrary( name.c_str() ); } // dynamic_library_traits_win32::open() /*------------------------------------------------------------------------*/ /** * \brief Open the current program. * \param name The name of the current program. * \return The handle on the loaded library. */ static handle auto_open( const std::string& name ) { return LoadLibrary( name.c_str() ); } // dynamic_library_traits_win32::auto_open() /*------------------------------------------------------------------------*/ /** * \brief Close a library. * \param h The handle of the library to close. */ static void close( handle h ) { FreeLibrary(h); } // dynamic_library_traits_win32::close() /*------------------------------------------------------------------------*/ /** * \brief Get a symbol from a library. * \param h Handle of the library. * \param name The name of the symbol to load. */ template static T get_symbol( handle h, const std::string& name ) { /* HACK : ISO standard doesn't allow to cast from a pointer to an object to a pointer to a function. */ T result; *(FARPROC*)(&result) = GetProcAddress( h, name.c_str() ); return result; } // dynamic_library_traits_win32::get_symbol() /*------------------------------------------------------------------------*/ /** * \brief Tell if a symbol is in the library. * \param h Handle of the library. * \param name The name of the symbol to find. */ static bool have_symbol( handle h, const std::string& name ) { return GetProcAddress( h, name.c_str() ) != NULL; } // dynamic_library_traits_win32::have_symbol() /*------------------------------------------------------------------------*/ /** * \brief Tell if an handle is a valid library handle. * \param h The handle to test. */ static bool valid_handle( handle h ) { return h != NULL; } // dynamic_library_traits_win32::valid_handle() }; // class dynamic_library_traits_win32 typedef dynamic_library_traits_win32 dynamic_library_traits; } // namespace claw #endif // __CLAW_DYNAMIC_LIBRARY_TRAITS_WIN32_HPP__ libclaw-1.7.4/claw/exception.hpp000066400000000000000000000047441216507631600166150ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file exception.hpp * \brief A simple class to use as exception with string message. * \author Julien Jorge */ #ifndef __CLAW_EXCEPTION_HPP__ #define __CLAW_EXCEPTION_HPP__ #include #include namespace claw { /** * \brief A simple class to use as exception with string message. * \author Julien Jorge */ class exception: public std::exception { public: /** * \brief Constructor. * \param msg A short description of the problem. */ exception( const std::string& msg ) throw() : m_msg(msg) { } /** \brief Desctructor. */ ~exception() throw() {} /** \brief Get a short description of the problem. */ const char* what() const throw() { return m_msg.c_str(); } private: /** A short description of the problem. */ const std::string m_msg; }; // class exception /** * \brief Exception thrown when accessing bad formated data. * \author Julien Jorge */ class bad_format: public exception { public: /** * \brief Constructor. * \param msg A short description of the problem. */ bad_format( const std::string& msg ) throw() : exception(msg) { } }; // class bad_format } // namespace claw /** * \brief Create an exception and add the name of the current function to the * message. * \param m A short description of the problem. */ #define CLAW_EXCEPTION( m ) \ claw::exception( std::string(__FUNCTION__) + ": " + m ) #endif // __CLAW_EXCEPTION_HPP__ libclaw-1.7.4/claw/factory.hpp000066400000000000000000000076421216507631600162660ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file factory.hpp * \brief The design pattern of the factory. * \author Julien Jorge */ #ifndef __CLAW_FACTORY_HPP__ #define __CLAW_FACTORY_HPP__ #ifdef CLAW_FACTORY_IS_SINGLETON #include #endif #include #include namespace claw { namespace pattern { /** * \brief Exception thrown when an incorrect identifier is given to a type. * \author Julien Jorge */ class bad_type_identifier: public exception { public: /** * \brief Constructor. */ bad_type_identifier() throw() : exception("No type has this identifier.") { } }; // class bad_type_identifier /** * \brief The design pattern of the factory allow to dynamically instanciate * classes of various types given an identifier of this type. * * \b Template \b parameters: * - \a BaseClass A base class for all classes instanciated by this factory. * - \a IdentifierType The type of the identifiers of the classes * instanciated by this factory. * * \b Type \b requirements: * - IdentifierType must be "less than" comparable. */ template #ifdef CLAW_FACTORY_IS_SINGLETON class factory: public basic_singleton< factory > #else class factory #endif { private: /** * \brief A class creator is an object that allocate a given type. This is * the base class for all class creators. */ class class_creator_base { public: virtual ~class_creator_base(); virtual BaseClass* create() const = 0; }; // class class_creator_base /** * \brief A class creator is an object that allocate a given type. * * \b Template \b parameters: * - \a Derived The type of the class to instanciate. * * \b Type \b requirements: * - Derived must be default constructible. */ template class class_creator: public class_creator_base { public: virtual Derived* create() const; }; // class class_creator /** \brief The type of the data used to identify a class. */ typedef IdentifierType identifier_type; /** \brief A base class for all instances created by this factory. */ typedef BaseClass base_class; /** \brief The association identifier <-> type. */ typedef std::map class_map; public: ~factory(); template bool register_type( const identifier_type& id ); base_class* create( const identifier_type& id ) const; bool is_known_type( const identifier_type& id ) const; private: /** \brief The association identifier <-> type. */ class_map m_classes; }; // class factory } // namespace pattern } // namespace claw #include #endif // __CLAW_FACTORY_HPP__ libclaw-1.7.4/claw/functional.hpp000066400000000000000000000221671216507631600167600ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file functional.hpp * \brief Some function object classes. * \author Julien Jorge */ #ifndef __CLAW_FUNCTIONAL_HPP__ #define __CLAW_FUNCTIONAL_HPP__ #include #include namespace claw { /*-------------------------------------------------------------------------*/ /** * \brief Fuction object to get the first element of a std::pair. * \author Julien Jorge */ template class first: public std::unary_function< std::pair, T1& > { public: T1& operator()( std::pair& p ) const { return p.first; } // operator() const }; // class first /*-------------------------------------------------------------------------*/ /** * \brief Fuction object to get the first element of a std::pair. * \author Julien Jorge */ template class const_first: public std::unary_function, const T1&> { public: const T1& operator()( const std::pair& p ) const { return p.first; } // operator() }; // class const_first /*-------------------------------------------------------------------------*/ /** * \brief Fuction object to get the first element of a std::pair. * * \remark Contrary to claw::first, the template argument is a std::pair. * \author Julien Jorge */ template class pair_first: public first { // nothing }; // class pair_first /*-------------------------------------------------------------------------*/ /** * \brief Fuction object to get the first element of a std::pair. * * \remark Contrary to claw::first, the template argument is a std::pair. * \author Julien Jorge */ template class const_pair_first: public const_first { // nothing }; // class const_pair_first /*-------------------------------------------------------------------------*/ /** * \brief Fuction object to get the second element of a std::pair. * \author Julien Jorge */ template class second: public std::unary_function< std::pair, T2& > { public: T2& operator()( std::pair& p ) const { return p.second; } // operator() const }; // class second /*-------------------------------------------------------------------------*/ /** * \brief Fuction object to get the second element of a std::pair. * \author Julien Jorge */ template class const_second: public std::unary_function< const std::pair, const T2& > { public: const T2& operator()( const std::pair& p ) const { return p.second; } // operator() }; // class const_second /*-------------------------------------------------------------------------*/ /** * \brief Fuction object to get the second element of a std::pair. * * \remark Contrary to claw::second, the template argument is a std::pair. * \author Julien Jorge */ template< class Pair > class pair_second: public second< typename Pair::first_type, typename Pair::second_type > { // nothing }; // class pair_second /*-------------------------------------------------------------------------*/ /** * \brief Fuction object to get the second element of a std::pair. * * \remark Contrary to claw::second, the template argument is a std::pair. * \author Julien Jorge */ template class const_pair_second: public const_second { public: const_pair_second() {} template const_pair_second( const second& ) {} }; // class const_pair_second /*-------------------------------------------------------------------------*/ /** * \brief Always true unary predicate. * * \b Template \b arguments: * - T Doesn't matter. * * \remark Use it when you need to process all elements but a method needs * an unary predicate parameter. * \author Julien Jorge */ template class unary_true: public std::unary_function { public: bool operator()( const T& t ) const { return true; } }; // class unary_true /*-------------------------------------------------------------------------*/ /** * \brief Always true binary predicate. * * \b Template \b arguments: * - T Doesn't matter, * - U Doesn't matter. * * \remark Use it when you need to process all elements but a method needs * an binary predicate parameter. * \author Julien Jorge */ template class binary_true: public std::binary_function { public: bool operator()( const T& t, const U& u ) const { return true; } // operator() }; // class binary_true /*-------------------------------------------------------------------------*/ /** * \brief Function object that compose two function objects. * * \b Template \b arguments: * - \a F1 The type of the first function, must be a model of Adaptable Unary * Function, * - \a F2 The type of the second function, must be a model of Adaptable Unary * Function. * * \author Julien Jorge */ template class unary_compose : public std::unary_function< typename F2::argument_type, typename F1::result_type > { public: unary_compose() {} /** * \brief Copy constructor. * \param that The instance to copy from. * * There is actually nothing to copy but this constructor is useful for * casting function objects. */ template unary_compose( const unary_compose& that ) { } /** * \brief Return (F1 o F2)(a). */ typename F1::result_type operator()( typename F2::argument_type& a ) const { return F1()( F2()(a) ); } }; // class unary_compose /*-------------------------------------------------------------------------*/ /** * \brief Function object that deletes a pointer. * * \b Template \b arguments: * - \a T The pointer type. * * \remark Use this function object to clear your container of pointers. * \author Julien Jorge */ template class delete_function: public std::unary_function { public: void operator()( const T& a ) const { delete a; } }; // class delete_function /*-------------------------------------------------------------------------*/ /** * \brief Function object that clones a pointer. * * \b Template \b arguments: * - \a T The pointed type (ie. int, not int*. * * \remark Use this function object to copy your container of pointers. * \author Julien Jorge */ template class clone: public std::unary_function { public: T* operator()( const T* a ) const { return new T(*a); } }; // class clone /*-------------------------------------------------------------------------*/ /** * \brief Function object that dereferences a pointer. * * \b Template \b arguments: * - \a T The pointed type (ie. int, not int*. * * \author Julien Jorge */ template class dereference: public std::unary_function { public: T& operator()( T* a ) const { return *a; } }; // class dereference /*-------------------------------------------------------------------------*/ /** * \brief Function object that dereferences a constant pointer. * * \b Template \b arguments: * - \a T The pointed type (ie. int, not int*. * * \author Julien Jorge */ template class const_dereference: public std::unary_function { public: const_dereference() { } const_dereference( const dereference& ) { } const_dereference( const const_dereference& ) { } const T& operator()( const T* a ) const { return *a; } }; // class const_dereference } // namespace claw #endif // __CLAW_FUNCTIONAL_HPP__ libclaw-1.7.4/claw/game_ai.hpp000066400000000000000000000166321216507631600162000ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005 SĂŠbastien Angibaud Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file game_ai.hpp * \brief Artificial intelligence for games. * \author Julien Jorge, SĂŠbastien Angibaud */ #ifndef __CLAW_GAME_AI_HPP__ #define __CLAW_GAME_AI_HPP__ #include namespace claw { namespace ai { namespace game { //**************************** game_state ******************************** /** * \brief A state of a game. * * \b Template \b parameters: * - \param Action: a type representing an action of a player. * - \param Numeric: the type used for evaluationg the players' scores. * * \author Julien Jorge */ template class game_state { public: /** \brief The type used for evaluationg the players' scores. */ typedef Numeric score; /** \brief A type representing an action of a player. */ typedef Action action; public: virtual ~game_state(); /** \brief Evaluate this state of the game. */ virtual score evaluate() const = 0; static score min_score(); static score max_score(); /** * \brief Get all actions that can be done from this state. * \param l (out) The actions. */ virtual void next_actions( std::list& l ) const = 0; /** * \brief Get a new state obtained when applying an action. * \param a The action to apply. * \return The state resulting from this action. */ virtual game_state* do_action( const action& a ) const = 0; /** \brief Tell if the game is over. */ virtual bool final() const = 0; protected : score fit( score score_val ) const; protected : /** \brief Minimal score that can be given to a state. */ static const score s_min_score; /** \brief Maximal score that can be given to a state. */ static const score s_max_score; }; // class game_state //**************************** action_eval ****************************** /** * \brief A score associated with an action. * * \b Template \b parameters: * - \a Action: the type of the action, * - \a Action: the type of the evaluation. */ template class action_eval { public: action_eval( const Action& a, const Numeric& e); bool operator< ( const action_eval& ae ) const; //bool operator==( const action_eval& ae ) const; public: /** \brief The action. */ Action action; /** \brief The score of the action. */ Numeric eval; }; // class action_eval //*************************** min_max *********************************** /** * \brief Find an action with the MinMax algorithm. * * \b Template \b parameters: * - \a State: the type of a state of the game. Must inherit from * game_state. * * \author Julien Jorge */ template class min_max { public: /** \brief The type of a state in the game. */ typedef State state; /** \brief The type of the actions that change the state of the game. */ typedef typename State::action action; /** \brief The type used to represent the score. */ typedef typename State::score score; score operator() ( int depth, const state& current_state, bool computer_turn ) const; }; // class min_max //*************************** alpha_beta ******************************** /** * \brief Find an action with the alpha-beta algorithm. * * \b Template \b parameters: * - \a State: the type of a state of the game. Must inherit from * game_state. * * \author Julien Jorge, SĂŠbastien Angibaud */ template class alpha_beta { public: /** \brief The type of a state in the game. */ typedef State state; /** \brief The type of the actions that change the state of the game. */ typedef typename State::action action; /** \brief The type used to represent the score. */ typedef typename State::score score; score operator() ( int depth, const state& current_state, bool computer_turn ) const; private: score compute ( int depth, const state& current_state, bool computer_turn, score alpha, score beta ) const; }; // class alpha_beta //*************************** select_action ***************************** /** * \brief Select an action using a given method (min_max, alpha_beta). * * \b Template \b parameters: * - \a Method: the method to use to evaluate the actions. * * \author Julien Jorge, SĂŠbastien Angibaud */ template class select_action { public: /** \brief The type of a state in the game. */ typedef typename Method::state state; /** \brief The type of the actions that change the state of the game. */ typedef typename Method::action action; /** \brief The type used to represent the score. */ typedef typename Method::score score; void operator() ( int depth, const state& current_state, action& new_action, bool computer_turn ) const; }; // class select_action //************************ select_random_action ************************* /** * \brief Select a random action among the best ones. * * \b Template \b parameters: * - \a Method: the method to use to evaluate the actions. * * \author Julien Jorge, SĂŠbastien Angibaud */ template class select_random_action { public: /** \brief The type of a state in the game. */ typedef typename Method::state state; /** \brief The type of the actions that change the state of the game. */ typedef typename Method::action action; /** \brief The type used to represent the score. */ typedef typename Method::score score; void operator()( int depth, const state& current_state, action& new_action, bool computer_turn ) const; }; // class select_random_action } // namespace game } // namespace it } // namespace claw #include #endif // __CLAW_IA_JEUX_HPP__ libclaw-1.7.4/claw/gif.hpp000066400000000000000000000332301216507631600153540ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file gif.hpp * \brief Image class for gif files. * \author Julien Jorge */ #ifndef __CLAW_GIF_HPP__ #define __CLAW_GIF_HPP__ #include #include #include #include #include #include #include namespace claw { namespace graphic { /** * \brief A class for gif pictures. * \author Julien Jorge */ class gif: public image { public: /** \brief One frame in the animation. */ class frame: public image { public: /** \brief The type of the parent class. */ typedef image super; public: frame(); frame( std::size_t w, std::size_t h ); void set_delay(unsigned int d); unsigned int get_delay() const; private: /** \brief Hundredths of a seconds to wait before continuing with the next frame. */ unsigned int m_delay; }; // class frame private: /** \brief A list of frame stored in the gif. */ typedef std::list frame_list; /** \brief The type of the parent class. */ typedef image super; public: /** \brief Iterator on the content of the gif. */ typedef wrapped_iterator < frame, frame_list::iterator, claw::dereference >::iterator_type frame_iterator; /** \brief Iterator on the content of the gif. */ typedef wrapped_iterator < const frame, frame_list::const_iterator, claw::const_dereference >::iterator_type const_frame_iterator; private: #pragma pack(push, 1) /** \brief Header of the gif files. */ struct header { /** \brief Signature of the format. */ u_int_8 signature[3]; /** \brief Version of the gif format. */ u_int_8 version[3]; }; // struct header /** \brief Some informations on the screen where the image is rendered. */ struct screen_descriptor { public: bool has_global_color_table() const; unsigned int color_palette_size() const; public: /** \brief Logical screen width. */ u_int_16 screen_width; /** \brief Logical screen height. */ u_int_16 screen_height; /** \brief Some flags. */ u_int_8 packed; /** \brief Background color index. */ u_int_8 background_color; /** \brief Pixel aspect ratio. */ u_int_8 aspect_ratio; }; // struct screen_descriptor /** Description of an image in the file. */ struct image_descriptor { public: /** \brief Identifier of the block. */ static const u_int_8 block_id = 0x2C; public: bool has_color_table() const; bool is_interlaced() const; unsigned int color_palette_size() const; public: /** \brief Left position in the logical screen. */ u_int_16 left; /** \brief Top position in the logical screen. */ u_int_16 top; /** \brief Width of the image. */ u_int_16 width; /** \brief Height of the image. */ u_int_16 height; /** \brief Some flags. */ u_int_8 packed; }; // struct image_descriptor /** \brief Extension of the format. */ struct extension { /** \brief Identifier of the block. */ static const u_int_8 block_id = 0x21; // no field }; // struct extension /** \brief The end of the file. */ struct trailer { /** \brief Identifier of the block. */ static const u_int_8 block_id = 0x3B; // no field }; // trailer /** \brief Extension describing a rendering block. */ struct graphic_control_extension { public: /** \brief Identifier of the extension. */ static const u_int_8 block_label = 0xF9; /** \brief Tell how to initialise the canvas before rendering a frame. */ enum disposal_method { /** \brief No disposal specified. The decoder is not required to take any action. */ dispose_none, /** \brief Do not dispose. The graphic is to be left in place. */ dispose_do_not_dispose, /** \brief Restore to background color. The area used by the graphic must be restored to the background color. */ dispose_background, /** \brief Restore to previous. The decoder is required to restore the area overwritten by the graphic with what was there prior to rendering the graphic. */ dispose_previous }; // enum disposal_method public: disposal_method get_disposal_method() const; bool has_transparent_color() const; public: /** \brief Number of bytes in the block. */ u_int_8 block_size; /** \brief Some flags. */ u_int_8 packed; /** \brief Hundredths of a second to wait before continuing. */ u_int_16 delay; /** \brief Index of the transparent color in the palette. */ u_int_8 transparent_color; /** \brief Block terminator. */ u_int_8 terminator; }; // struct graphic_control_extension /** \brief Extension commenting the file. */ struct comment_extension { public: /** \brief Identifier of the extension. */ static const u_int_8 block_label = 0xFE; public: // this block is ignored. }; // struct comment_extension /** \brief Extension adding graphic text support. */ struct plain_text_extension { public: /** \brief Identifier of the extension. */ static const u_int_8 block_label = 0x01; public: // this block is ignored. }; // struct plain_text_extension /** \brief Extension adding some informations about the application. */ struct application_extension { public: /** \brief Identifier of the extension. */ static const u_int_8 block_label = 0xFF; public: // this block is ignored. }; // struct application_extension #pragma pack(pop) public: /*----------------------------------------------------------------------*/ /** * \brief This class reads data from a gif file. The image is resized to * the size of the screen (as defined in the gif file) and the * frames are stored in a list of frames passed as parameter. * \author Julien Jorge */ class reader { private: /** \brief The type of the color palettes in the file. */ typedef color_palette palette_type; /** \brief Some global data needed when reading the file. */ struct reader_info { /** \brief Description of the screen. */ screen_descriptor sd; /** \brief The global palette. */ palette_type* palette; /** \brief The index of the transparent color for the current frame.*/ int transparent_color_index; /** \brief The disposal method of the frames. */ std::vector disposal_method; }; // struct reader_info /** \brief The buffer passed to the LZW decoder to decode the input. */ class input_buffer { public: input_buffer( std::istream& is, u_int_8 code_size ); bool end_of_data() const; bool end_of_information() const; unsigned int symbols_count() const; unsigned int get_next(); void reset(); void new_code( unsigned int code ); private: void fill_buffer(); private: /** \brief The last value read from the input. */ unsigned int m_val; /** \brief The input data. */ std::istream& m_input; /** * \brief Encoded data read from the stream. * * A data block is 255 bytes long, maximum. But we may have to keep up * to 12 bits from the previous block. So we need two more bytes. */ char m_buffer[257]; /** \brief The position of the next byte to read in \a m_buffer. */ std::size_t m_pending; /** \brief The number of available bits in m_buffer[m_pending]. */ unsigned char m_pending_bits; /** \brief The end of the data in \a m_buffer; */ std::size_t m_pending_end; /** \brief The length of the next data block. */ u_int_8 m_next_data_length; /** \brief The initial size of the codes. */ const unsigned int m_initial_code_size; /** \brief The current size of the codes. */ unsigned int m_code_size; /** \brief The maximum code allowed with the current code size. */ unsigned int m_code_limit; }; // class input_buffer /** \brief Buffer passed to the LZW decoder to write decoded data. */ class output_buffer { public: output_buffer ( const palette_type& p, const image_descriptor& id, int transparent_color_index, image& output ); void write( unsigned int code ); private: /** \brief The palette from whick we take the colors of the image. */ const palette_type& m_palette; /** \brief The image descriptor of the frame. */ const image_descriptor& m_id; /** \brief The index of the transparent color. -1 if none. */ const int m_transparent_color_index; /** \brief The image in which we save the decoded data. */ image& m_output; /** \brief The x-position of the next pixel in the image. */ std::size_t m_x; /** \brief The y-position of the next pixel in the image. */ std::size_t m_y; /** \brief Current pass in an interlaced image [0-3]. */ int m_interlace_pass; /** \brief Increment in the current pass of an interlaced image. */ int m_interlace_step; }; // class output_buffer /** \brief LZW decoder for the GIF data. */ typedef claw::lzw_decoder gif_lzw_decoder; public: reader( image& img ); reader( image& img, std::istream& f ); reader( frame_list& frames, std::istream& f ); reader( image& img, frame_list& frames, std::istream& f ); ~reader(); void load( std::istream& f ); private: void clear(); void inside_load( std::istream& f ); void make_frames( const reader_info& info ); void fill_background( image& img, const reader_info& info ) const; void check_if_gif( std::istream& f ) const; void read_screen_descriptor( std::istream& f, reader_info& info ); void read_palette( std::istream& f, palette_type& p ) const; void read_data( std::istream& f, reader_info& info ); void read_frame( std::istream& f, reader_info& info ); void read_frame_with_gce( std::istream& f, reader_info& info ); void skip_extension( std::istream& f ) const; void read_frame_data ( std::istream& f, const reader_info& info, frame& the_frame ) const; void decode_data ( std::istream& f, const palette_type& palette, const image_descriptor& id, int transparent_color_index, frame& the_frame ) const; private: /** \brief The gif file on which we work. */ image* m_image; /** \brief The images in which we store the data we read. */ frame_list m_frame; }; // class reader public: gif(); gif( const gif& that ); gif( std::istream& f ); ~gif(); gif& operator=( const gif& that ); void swap( gif& that ); frame_iterator frame_begin(); frame_iterator frame_end(); const_frame_iterator frame_begin() const; const_frame_iterator frame_end() const; private: /** \brief The list of frames in the animation. */ frame_list m_frame; }; // class gif } // namespace graphic } // namespace claw namespace std { void swap( claw::graphic::gif& a, claw::graphic::gif& b ); } // namespace std #endif // __CLAW_GIF_HPP__ libclaw-1.7.4/claw/glob.hpp000066400000000000000000000035461216507631600155410ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file glob.hpp * \brief Globalization algorithm. * \author Julien Jorge */ #ifndef __CLAW_GLOB_HPP__ #define __CLAW_GLOB_HPP__ namespace claw { template bool glob_match ( InputIterator1 pattern_first, InputIterator1 pattern_last, InputIterator2 first, InputIterator2 last, typename InputIterator1::value_type any_sequence, typename InputIterator1::value_type zero_or_one, typename InputIterator1::value_type any ); template bool glob_potential_match ( InputIterator1 pattern_first, InputIterator1 pattern_last, InputIterator2 first, InputIterator2 last, typename InputIterator1::value_type any_sequence, typename InputIterator1::value_type zero_or_one, typename InputIterator1::value_type any ); } // namespace claw #include #endif // __CLAW_GLOB_HPP__ libclaw-1.7.4/claw/graph.hpp000066400000000000000000000202461216507631600157130ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file graph.hpp * \brief A class to represent a graph. * \author Julien Jorge */ #ifndef __CLAW_GRAPH_HPP__ #define __CLAW_GRAPH_HPP__ #include #include #include #include #include #include #include #include namespace claw { /** * \brief The exceptions thrown by the graphs. * \author Julien Jorge */ class graph_exception: public std::exception { public: graph_exception() throw(); graph_exception( const std::string& s) throw(); virtual ~graph_exception() throw(); virtual const char* what() const throw(); private: /** \brief A short explanation of the problem. */ const std::string m_msg; }; // graph_exception /** * \brief A class to represent a graph. * * Constraints on the template parameters: * - S is LessThanComparable, * - A is any Assignable and Default Constructible, * - Comp is a binary predicate such that Comp(S a, S b) == true if and * only if a < b. * * \author Julien Jorge */ template > class graph { public: /** \brief Type of the vertices. */ typedef S vertex_type; /** \brief Type of the edges. */ typedef A edge_type; /** \brief Binary predicate to compare vertices. */ typedef Comp vertex_compare; /** \brief The adjacency list of a vertex. vertex_type is the target vertex, edge_type is the label on the edge. */ typedef std::map neighbours_list; /** \brief The whole graph: an adjacency list for each vertex. */ typedef std::map graph_content; /** \brief Type of the current structure. */ typedef claw::graph self_type; /** * \brief Iterator on the graph's vertices. */ class graph_vertex_iterator { friend class graph; public: typedef const vertex_type value_type; typedef const vertex_type& reference; typedef const vertex_type* const pointer; typedef ptrdiff_t difference_type; typedef std::bidirectional_iterator_tag iterator_category; public: graph_vertex_iterator(); graph_vertex_iterator& operator++(); graph_vertex_iterator operator++(int); graph_vertex_iterator& operator--(); graph_vertex_iterator operator--(int); reference operator*() const; pointer operator->() const; bool operator==(const graph_vertex_iterator& it) const; bool operator!=(const graph_vertex_iterator& it) const; private: explicit graph_vertex_iterator( typename graph_content::const_iterator it ); private: /** \brief Iterator on the list of vertex. */ typename graph_content::const_iterator m_iterator; }; // class graph_vertex_iterator /** * \brief Iterator on the graph's edges. */ class graph_edge_iterator { friend class graph; public: /** * \brief Value pointed by the iterator. */ class edge { friend class graph_edge_iterator; public: edge(); const edge_type& label() const; const vertex_type& source() const; const vertex_type& target() const; private: void set( const edge_type& l, const vertex_type& s, const vertex_type& t ); private: edge_type const* m_label; vertex_type const* m_source; vertex_type const* m_target; }; // class edge public: typedef const edge value_type; typedef const edge& reference; typedef const edge* const pointer; typedef ptrdiff_t difference_type; typedef std::bidirectional_iterator_tag iterator_category; public: graph_edge_iterator(); graph_edge_iterator& operator++(); graph_edge_iterator operator++(int); graph_edge_iterator& operator--(); graph_edge_iterator operator--(int); reference operator*() const; pointer operator->() const; bool operator==(const graph_edge_iterator& it) const; bool operator!=(const graph_edge_iterator& it) const; private: explicit graph_edge_iterator( typename graph_content::const_iterator it_begin, typename graph_content::const_iterator it_end, typename graph_content::const_iterator it_s, typename neighbours_list::const_iterator it_d ); private: /** \brief Iterator of the first node. */ typename graph_content::const_iterator m_vertex_begin; /** \brief Iterator of the last node. */ typename graph_content::const_iterator m_vertex_end; /** \brief Iterator on the list of vertex. */ typename graph_content::const_iterator m_vertex_iterator; /** \brief Iterator on the list of edges. */ typename neighbours_list::const_iterator m_neighbours_iterator; /** \brief Current edge. */ edge m_edge; }; // class graph_edge_iterator public: typedef graph_vertex_iterator vertex_iterator; typedef graph_edge_iterator edge_iterator; typedef std::reverse_iterator reverse_vertex_iterator; typedef std::reverse_iterator reverse_edge_iterator; public: graph(); void add_edge( const vertex_type& s1, const vertex_type& s2, const edge_type& e = edge_type() ); void add_vertex( const vertex_type& s ); bool edge_exists( const vertex_type& s, const vertex_type& r ) const; void neighbours( const vertex_type& s, std::vector& v ) const; void vertices( std::vector& v ) const; vertex_iterator vertex_begin() const; vertex_iterator vertex_end() const; vertex_iterator vertex_begin( const vertex_type& s ) const; reverse_vertex_iterator vertex_rbegin() const; reverse_vertex_iterator vertex_rend() const; reverse_vertex_iterator vertex_rbegin( const vertex_type& s ) const; edge_iterator edge_begin() const; edge_iterator edge_end() const; edge_iterator edge_begin( const vertex_type& s1, const vertex_type& s2 ) const; reverse_edge_iterator edge_rbegin() const; reverse_edge_iterator edge_rend() const; reverse_edge_iterator edge_rbegin( const vertex_type& s1, const vertex_type& s2 ) const; const edge_type& label( const vertex_type& s, const vertex_type& r ) const; std::size_t outer_degree( const vertex_type& s ) const; std::size_t inner_degree( const vertex_type& s ) const; std::size_t vertices_count() const; std::size_t edges_count() const; private: /** \brief The content of the graph (edges and vertices. */ graph_content m_edges; /** \brief Inner degree of the vertices. */ std::map m_inner_degrees; /** \brief Number of edges. */ std::size_t m_edges_count; }; // class graph } // namespace claw #include #endif // __CLAW_GRAPH_HPP__ libclaw-1.7.4/claw/graph_algorithm.hpp000066400000000000000000000112311216507631600177530ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file graph_algorithm.hpp * \brief Various algorithms for graph manipulation. * \author Julien Jorge */ #ifndef __CLAW_GRAPH_ALGORITHM_HPP__ #define __CLAW_GRAPH_ALGORITHM_HPP__ #include namespace claw { //*************************** graph::scan_events **************************** /** * \brief Different stages of graph scanning. */ template class scan_events { public: typedef typename Graph::vertex_type vertex_type; public: void init( const Graph& g ) {} void start_vertex( const vertex_type& v ) {} void visit_edge( const vertex_type& v1, const vertex_type& v2 ) {} void end_vertex( const vertex_type& v ) {} }; // class scan_events //************************** breadth_scan *********************************** /** * \brief This class performs a depth scan of a graph. Only reachables * vertices from a given vertex are proceeded. */ template > class breadth_scan { public: typedef typename Graph::vertex_type vertex_type; typedef typename Graph::vertex_iterator vertex_iterator ; /** * \brief Colors are : * - 0 : never seen. * - 1 : seen but not done. * - 2 : done. */ typedef std::map coloration; public: breadth_scan( const Graph& g, const vertex_type& source, Events& events ); void operator()(); private: const Graph& m_g; const vertex_type& m_source; Events& m_events; }; // class breadth_scan //**************************** depth_scan *********************************** /** * \brief This class performs a depth scan of a graph. All nodes are * proceeded. */ template class depth_scan { public: typedef typename Graph::vertex_type vertex_type; typedef typename Graph::vertex_iterator vertex_iterator ; /** * \brief Colors are : * - 0 : never seen. * - 1 : seen but not done. * - 2 : done. */ typedef std::map coloration; public: depth_scan( const Graph& g, Events& events ); void operator()(); private: void recursive_scan(const vertex_type& s, coloration& seen_vertices); private: const Graph& m_g; Events& m_events; }; // class depth_scan //********************** topological_sort *********************************** /** * \brief Pass this class as the "Envents" template parameter of the * depth scan class to sort the vertices of a graph with the * topological sort algorithm. * * When a node process ends, the node is added to a vector. The vector is * filled from end to begining. */ template class topological_sort : public scan_events { public: typedef typename scan_events::vertex_type vertex_type; typedef std::vector result_type; typedef typename result_type::const_iterator const_iterator; typedef topological_sort self_type; public: void init( const Graph& g ); void end_vertex( const vertex_type& s ); void operator()( const Graph& g ); const vertex_type& operator[](unsigned int index) const; const_iterator begin() const; const_iterator end() const; private: /** \brief The vector we're filling. */ result_type m_result; /** \brief Index of the next item to put in the vector. */ int m_next_index; }; // class topological_sort } // namespace claw #include #endif // __CLAW_GRAPH_ALGORITHM_HPP__ libclaw-1.7.4/claw/image.hpp000066400000000000000000000164331216507631600156770ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file image.hpp * \brief A class to deal with images. * \author Julien Jorge */ #ifndef __CLAW_IMAGE_HPP__ #define __CLAW_IMAGE_HPP__ #include #include #include #include #include #include namespace claw { namespace graphic { /** * \brief A class to deal with images. * \author Julien Jorge */ class image { public: /** \brief The type representing the colors of the pixels in the image. */ typedef rgba_pixel pixel_type; /** * \brief One line in the image. * \author Julien Jorge */ class scanline: private std::vector { friend class image; public: /** \brief The type of the parent class. */ typedef std::vector super; /** \brief The type of the pixels. */ typedef super::value_type value_type; /** \brief Reference to a pixel.. */ typedef super::reference reference; /** \brief Const reference to a pixel. */ typedef super::const_reference const_reference; /** \brief Iterator in the line. */ typedef super::iterator iterator; /** \brief Const iterator in the line. */ typedef super::const_iterator const_iterator; /** \brief An unsigned integral type. */ typedef super::size_type size_type; public: iterator begin(); iterator end(); const_iterator begin() const; const_iterator end() const; inline reference operator[](unsigned int i); inline const_reference operator[](unsigned int i) const; size_type size() const; }; // class scanline public: /** * \brief Base class for iterators on an image. * \author Julien Jorge. */ template class base_iterator: public std::iterator { private: /** \brief The type of the image we are iterating through. */ typedef Image image_type; /** \brief The type of the pointed pixels. */ typedef Pixel pixel_type; /** \brief The type of the current class. */ typedef base_iterator self_type; public: /** \brief The type of the values accessed by the iterator. */ typedef pixel_type value_type; /** \brief The type of the references to the values accesssed by the iterator. */ typedef pixel_type& reference; /** \brief The type of the pointers to the values accesssed by the iterator. */ typedef pixel_type* pointer; /** \brief The type of the distance between two iterators. */ typedef ptrdiff_t difference_type; /** \brief The type of this category. */ typedef std::random_access_iterator_tag iterator_category; public: inline base_iterator(); inline base_iterator( image_type& owner, unsigned int x=0, unsigned int y = 0 ); inline bool operator==( const self_type& that ) const; inline bool operator!=( const self_type& that ) const; inline bool operator<( const self_type& that ) const; inline bool operator>( const self_type& that ) const; inline bool operator<=( const self_type& that ) const; inline bool operator>=( const self_type& that ) const; inline self_type& operator+=( int n ); inline self_type& operator-=( int n ); inline self_type operator+( int n ) const; inline self_type operator-( int n ) const; /** * \brief Get an iterator at a specific distance of the current * iterator. * \param n The distance of the wanted iterator. * \param self The reference iterator. */ template friend inline self_type operator+( int n, const self_type& self ); inline difference_type operator-( const self_type& that ) const; inline self_type& operator++(); inline self_type operator++(int); inline self_type& operator--(); inline self_type operator--(int); inline reference operator*() const; inline pointer operator->() const; inline reference operator[]( int n ) const; private: bool is_final() const; private: /** \brief The image we are iterating through. */ image_type* m_owner; /** \brief Coordinates of the pointed pixel in m_owner. */ math::coordinate_2d m_pos; }; // class base_iterator public: /** * \brief The type of the iterator on the pixels of the image. * * The pixels are accessed from the top line to the bottom line, and from * the left to the right. */ typedef base_iterator iterator; /** * \brief The type of the iterator to access constant pixels. * * The pixels are accessed from the top line to the bottom line, and from * the left to the right. */ typedef base_iterator const_iterator; public: image(); image( unsigned int w, unsigned int h ); image( std::istream& f ); void swap( image& that ); unsigned int width() const; unsigned int height() const; inline scanline& operator[](unsigned int i); inline const scanline& operator[](unsigned int i) const; iterator begin(); iterator end(); const_iterator begin() const; const_iterator end() const; void merge( const image& that ); void merge ( const image& that, const math::coordinate_2d& pos ); void partial_copy ( const image& that, const math::coordinate_2d& pos ); void flip(); void fill( const math::rectangle r, const pixel_type& c ); void set_size( unsigned int w, unsigned int h ); void load( std::istream& f ); private: /** \brief Data of the picture. */ std::vector m_data; }; // class image } // namespace graphic } // namespace claw namespace std { void swap( claw::graphic::image& a, claw::graphic::image& b ); } // namespace std // Inline methods #include #endif // __CLAW_IMAGE_HPP__ libclaw-1.7.4/claw/impl/000077500000000000000000000000001216507631600150365ustar00rootroot00000000000000libclaw-1.7.4/claw/impl/CMakeLists.txt000066400000000000000000000002371216507631600176000ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw) file(GLOB CLAW_CODE "*.[ti]pp") install( FILES ${CLAW_CODE} DESTINATION "${CLAW_INSTALLDIR_SOURCE}/impl" ) libclaw-1.7.4/claw/impl/algorithm.tpp000066400000000000000000000112771216507631600175610ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file algorithm.tpp * \brief Generic algorithms on sequences. * \author Julien Jorge */ /*----------------------------------------------------------------------------*/ /** * \brief Apply an unary function to all members of a sequence. * * This function works like std::for_each() but allows the function to apply * non-const methods to its argument. * * \param first Iterator on the first element of the sequence. * \param last Iterator just past the end of the sequence. * \param f Function to apply to the elements of the sequence. * * \remark The return value of the unary function is ignored. */ template UnaryFunction claw::inplace_for_each ( InputIterator first, InputIterator last, UnaryFunction f ) { for (; first!=last; ++first) f(*first); return f; } // inplace_for_each() /*----------------------------------------------------------------------------*/ /** * \brief Find the position in a range of the first element not in the * elements of a given range. * * \param first1 Iterator on the first element of the sequence in which we * search. * \param last1 Iterator just past the end of the sequence in which we search. * \param first2 Iterator on the first element of the range of the elements to * skip. * \param last2 Iterator just past the end of the range of the elements to * skip. */ template ForwardIterator1 claw::find_first_not_of ( ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2 ) { for ( ; first1!=last1; ++first1 ) { bool found(false); for ( ForwardIterator2 it(first2); !found && (it!=last2); ++it ) found = *first1 == *it; if (!found) return first1; } return last1; } // find_first_not_of() /*----------------------------------------------------------------------------*/ /** * \brief Replace a set of elements in a range by other elements. * \param first Iterator on the first element in the range to modify. * \param last Iterator just past the end of the range to modify. * \param e1_first Iterator on the first element to replace. * \param e1_last Iterator just past the last element to replace. * \param e2_first Iterator on the first element to replace with. * \param e2_last Iterator just past the last element to replace with. * * \return The number of replaced elements. * * Each element *(e1_first + i) will be replaced with *(e2_first + i). * If the range (\a e1_first, \a e1_last) is smaller than * (\a e2_first, \a e2_last), the latter will be completed by repeating its last * element. * * \b Example : * * int* r = { 1, 0, 1, 1, 0, 2, 3, 0, 5, 1 }; * unsigned int* e1 = { 0, 1, 2 }; * unsigned int* e2 = { 1, 0 }; * claw::replace( r, r+10, e1, e1+3, e2, e2+2 ); * // r is now { 0, 1, 0, 0, 1, 0, 3, 1, 5, 0 } * */ template std::size_t claw::replace ( ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 e1_first, ForwardIterator2 e1_last, ForwardIterator3 e2_first, ForwardIterator3 e2_last ) { if ( (e1_first == e1_last) || (e2_first == e2_last) ) return 0; std::size_t count(0); for ( ; first != last; ++first ) { bool stop(false); ForwardIterator3 r(e2_first); for (ForwardIterator2 it=e1_first; !stop && (it!=e1_last); ++it) { if ( *first == *it ) { *first = *r; ++count; stop = true; } else { ForwardIterator3 n=r; ++n; if (n!=e2_last) r = n; } } } return count; } // replace() libclaw-1.7.4/claw/impl/automaton.tpp000066400000000000000000000331111216507631600175710ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file automaton.tpp * \brief Implementation of the claw::automaton class. * \author Julien Jorge */ #include #include #include //***************************** automate ************************************** /*----------------------------------------------------------------------------*/ template typename claw::automaton::state_compare claw::automaton::s_state_compare; /*----------------------------------------------------------------------------*/ /** * \brief Add an edge in the automaton. * \param s1 Source state. * \param s2 Target state. * \param e The label on the edge. */ template void claw::automaton::add_edge ( const state_type& s1, const state_type& s2, const edge_type& e ) { add_state(s1); add_state(s2); m_states[s1].insert(typename neighbours_list::value_type(e,s2)); m_alphabet.insert(e); } // automaton::add_edge() /*----------------------------------------------------------------------------*/ /** * \brief Remove an edge from the atomaton. * \param s1 Source state. * \param s2 Target state. * \param e The label on the edge. */ template void claw::automaton::remove_edge ( const state_type& s1, const state_type& s2, const edge_type& e ) { typename neighbours_list::iterator it = m_states[s1].lower_bound(e); bool ok = false; while( (it != m_states[s1].upper_bound(e)) && !ok ) if ( it->second == s2 ) ok = true; else ++it; if (ok) m_states[s1].erase(it); } // automaton::remove_edge() /*----------------------------------------------------------------------------*/ /** * \brief Add a state in the automaton. * \param s The state to add. */ template void claw::automaton::add_state ( const state_type& s ) { std::pair p; if (m_states.find(s) == m_states.end()) { p.first = s; m_states.insert(p); } } // automaton::add_state() /*----------------------------------------------------------------------------*/ /** * \brief Add an initial state. * \param s The state to add. */ template void claw::automaton::add_initial_state ( const state_type& s ) { add_state(s); m_initial_states.insert(s); } // automaton::add_initial_state() /*----------------------------------------------------------------------------*/ /** * \brief Add a final state. * \param s The state to add. */ template void claw::automaton::add_final_state ( const state_type& s ) { add_state(s); m_final_states.insert(s); } // automaton::add_final_state() /*----------------------------------------------------------------------------*/ /** * \brief Tell of the automaton contains a given state. * \param s The state to check. */ template bool claw::automaton::state_exists ( const state_type& s ) const { return (m_states.find(s) != m_states.end()); } // automaton::state_exists() /*----------------------------------------------------------------------------*/ /** * \brief Tell if a state is final. * \param s The state to check. * \pre state_exists(s) == true */ template bool claw::automaton::state_is_final ( const state_type& s ) const { CLAW_PRECOND( state_exists(s) ); return m_final_states.find(s) != m_final_states.end(); } // automaton::state_is_final() /*----------------------------------------------------------------------------*/ /** * \brief Tell if a state is an initial state. * \param s The state to check. * \pre state_exists(s) == true */ template bool claw::automaton::state_is_initial ( const state_type& s ) const { CLAW_PRECOND( state_exists(s) ); return m_initial_states.find(s) != m_initial_states.end(); } // automaton::state_is_initial /*----------------------------------------------------------------------------*/ /** * \brief Get the states in the automaton. * \param v (out) The container in which to add the states. * \todo Remove this method and add iterator types. */ template void claw::automaton::states (result_state_list& v) const { v.clear(); v.resize( m_states.size() ); std::transform( m_states.begin(), m_states.end(), v.begin(), const_first() ); } // automaton::states() /*----------------------------------------------------------------------------*/ /** * \brief Get the final states. * \param v (out) The container in which to add the states. * \todo Remove this method and add iterator types. */ template void claw::automaton::final_states ( result_state_list& v ) const { v.clear(); v.resize( m_final_states.size() ); std::copy( m_final_states.begin(), m_final_states.end(), v.begin() ); } // automaton::final_states() /*----------------------------------------------------------------------------*/ /** * \brief Get the final states. * \param v (out) The container in which to add the states. * \todo Remove this method and add iterator types. */ template void claw::automaton::initial_states ( result_state_list& v ) const { v.clear(); v.resize( m_initial_states.size() ); std::copy( m_initial_states.begin(), m_initial_states.end(), v.begin() ); } // automaton::initial_states() /*----------------------------------------------------------------------------*/ /** * \brief Get all symbols in the alphabet. * \param v (out) The container in which to add the symbols * \todo Remove this method and add iterator types. */ template void claw::automaton::alphabet ( result_edge_list& v ) const { v.clear(); v.resize( m_alphabet.size() ); std::copy( m_alphabet.begin(), m_alphabet.end(), v.begin() ); } // automaton::alphabet() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the automaton recognizes a given pattern. * \param first Iterator on the first symbol in the pattern. * \param last Iterator after the last symbol in the pattern. */ template template bool claw::automaton::match (InputIterator first, InputIterator last) const { bool ok = false; typename claw::avl::const_iterator it; for ( it=m_initial_states.begin(); (it!=m_initial_states.end()) && !ok; ++it ) ok = match_aux(*it, first, last); return ok; } // automaton::match() /*----------------------------------------------------------------------------*/ /** * \brief Get the number of states. */ template unsigned int claw::automaton::states_count() const { return m_states.size(); } // automaton::states_count() /*----------------------------------------------------------------------------*/ /** * \brief Get the states that can be reached from a given state with a given * symbol. * \param s Initial state. * \param e The symbol on the edge. * \param l (out) The list of reachable states. * \pre state_exists(s) == true * \todo Remove this method and add iterator types. */ template void claw::automaton::reachables ( const state_type& s, const edge_type& e, result_state_list& l ) const { CLAW_PRECOND( state_exists(s) ); typename adjacent_list::const_iterator it = m_states.find(s); l.clear(); l.resize( it->second.count(e) ); std::transform( it->second.lower_bound(e), it->second.upper_bound(e), l.begin(), claw::second() ); } // automaton::reachables() /*----------------------------------------------------------------------------*/ /** * \brief Get the states that can be reached from a given state, no matter the * symbol. * \param s Initial state. * \param l (out) The list of reachable states. * \pre state_exists(s) == true * \todo Remove this method and add iterator types. */ template void claw::automaton::reachables ( const state_type& s, result_state_list& l ) const { CLAW_PRECOND( state_exists(s) ); typename adjacent_list::const_iterator it_s = m_states.find(s); typename neighbours_list::const_iterator it; claw::avl reachable_states; for (it = it_s->second.begin(); it != it_s->second.end(); ++it) reachable_states.insert( it->second ); l.clear(); l.resize( reachable_states.size() ); std::copy( reachable_states.begin(), reachable_states.end(), l.begin() ); } // automaton::reachables_states() /*----------------------------------------------------------------------------*/ /** * \brief Get all the edges between two states. * \param s1 Source state. * \param s2 Target state. * \param l (out) The list of edges. * \pre (state_exists(s1) == true) && (state_exists(s2) == true) * \todo Remove this method and add iterator types. */ template void claw::automaton::edges ( const state_type& s1, const state_type& s2, result_edge_list& l ) const { CLAW_PRECOND( state_exists(s1) ); CLAW_PRECOND( state_exists(s2) ); typename adjacent_list::const_iterator it_s = m_states.find(s1); typename neighbours_list::const_iterator it; l.clear(); l.reserve( it_s->second.size() ); // pessimistic for (it = it_s->second.begin(); it != it_s->second.end(); ++it ) if ( !( s_state_compare(it->second, s2) || s_state_compare(s2, it->second) ) ) l.push_back(it->first); } // automaton::edges() /*----------------------------------------------------------------------------*/ /** * \brief Get all out-edges of a given state, labeled with a given symbol. * \param s1 The source state of the edges. * \param e The symbol on the edges. * \param l (out) The list of edges. * \pre state_exists(s1) == true * \todo Remove this method and add iterator types. */ template void claw::automaton::edges ( const state_type& s1, const edge_type& e, result_edge_list& l ) const { CLAW_PRECOND( state_exists(s1) ); typename adjacent_list::const_iterator it_s = m_states.find(s1); l.clear(); l.resize( it_s->second.count(e) ); std::transform( it_s->second.lower_bound(e), it_s->second.upper_bound(e), l.begin(), claw::first() ); } // automaton::edges() /*================================== private =================================*/ /*----------------------------------------------------------------------------*/ /** * \brief Recognize a pattern (recursive and auxiliary method). * \param s The state on which we start the search. * \param first Iterator on the first symbol to recognize. * \param last Iterator past the last symbol to recognize. */ template template bool claw::automaton::match_aux (const state_type& s, InputIterator first, InputIterator last) const { CLAW_PRECOND( state_exists(s) ); bool ok = false; if ( first == last ) ok = state_is_final(s); else { typename neighbours_list::const_iterator candidate, last_candidate; InputIterator next_symbol = first; ++next_symbol; candidate = m_states.find(s)->second.lower_bound(*first); last_candidate = m_states.find(s)->second.upper_bound(*first); for (; (candidate != last_candidate) && !ok; ++candidate ) ok = match_aux(candidate->second, next_symbol, last); } return ok; } // automaton::match_aux() libclaw-1.7.4/claw/impl/avl.tpp000066400000000000000000000206421216507631600163510ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file avl.tpp * \brief The avl class implementation. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief AVL constructor. * \post empty() */ template claw::avl::avl() { } // avl::avl() [constructor] /*----------------------------------------------------------------------------*/ /** * \brief AVL copy constructor. * \param that AVL instance to copy from. */ template claw::avl::avl( const avl& that ) : m_tree(that.m_tree) { } // avl::avl() [copy constructor] /*----------------------------------------------------------------------------*/ /** * \brief Constructor from a range. * \param first Iterator on the first element of the range. * \param last Iterator just past the last element of the range. */ template template claw::avl::avl( InputIterator first, InputIterator last ) { m_tree.insert(first, last); } // avl::avl() [constructor from range] /*----------------------------------------------------------------------------*/ /** * \brief Add a value in a tree. * \param key Node key. * \post exists(key) */ template void claw::avl::insert( const K& key ) { m_tree.insert(key); } // avl::insert() /*----------------------------------------------------------------------------*/ /** * \brief Add a range of items in the tree. * \param first Iterator on the first item to add. * \param last Iterator past the last item to add. * \pre Iterator::value_type is K * \post exists( *it ) for all it in [first, last) */ template template void claw::avl::insert( InputIterator first, InputIterator last ) { m_tree.insert(first, last); } // avl::insert() /*----------------------------------------------------------------------------*/ /** * \brief Delete a value in a tree. * \param key Node key. * \post not exists(key) */ template void claw::avl::erase( const K& key ) { m_tree.erase(key); } // avl::erase() /*----------------------------------------------------------------------------*/ /** * \brief Clear a tree. * \post empty() */ template void claw::avl::clear() { m_tree.clear(); } // avl::clear() /*----------------------------------------------------------------------------*/ /** * \brief Get the size of a tree. * \return The size of the tree. */ template inline unsigned int claw::avl::size() const { return m_tree.size(); } // avl::size() /*----------------------------------------------------------------------------*/ /** * \brief Tell if a tree is empty or not. * \return true if the tree is empty, false otherwise. */ template inline bool claw::avl::empty() const { return m_tree.empty(); } // avl::empty() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the nodes of the tree. */ template typename claw::avl::const_iterator claw::avl::begin() const { return m_tree.begin(); } // avl::begin() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator after the end of the tree. */ template typename claw::avl::const_iterator claw::avl::end() const { return m_tree.end(); } // avl::end() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the nodes of the tree from a specified key. * \param key Key to find. */ template typename claw::avl::const_iterator claw::avl::find( const K& key ) const { return m_tree.find(key); } // avl::find() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the nodes of the tree on the key imediatly after * from a specified key. * \param key Key to find. */ template typename claw::avl::const_iterator claw::avl::find_nearest_greater( const K& key ) const { return m_tree.find_nearest_greater(key); } // avl::find_nearest_greater() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the nodes of the tree on the key imediatly before * from a specified key. * \param key Key to find. */ template typename claw::avl::const_iterator claw::avl::find_nearest_lower( const K& key ) const { return m_tree.find_nearest_lower(key); } // avl::find_nearest_lower() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the lowest value of the tree. */ template typename claw::avl::const_iterator claw::avl::lower_bound() const { return m_tree.lower_bound(); } // avl::lower_bound() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the gratest value of the tree. */ template typename claw::avl::const_iterator claw::avl::upper_bound() const { return m_tree.upper_bound(); } // avl::upper_bound() /*----------------------------------------------------------------------------*/ /** * \brief Assignment. * \param that The instance to copy from. */ template claw::avl& claw::avl::operator=( const avl& that ) { m_tree = that.m_tree; return *this; } // avl::operator=() /*----------------------------------------------------------------------------*/ /** * \brief Equality. * \param that The instance to compare to. */ template bool claw::avl::operator==( const avl& that ) const { return m_tree == that.m_tree; } // avl::operator==() /*----------------------------------------------------------------------------*/ /** * \brief Disequality. * \param that The instance to compare to. */ template bool claw::avl::operator!=( const avl& that ) const { return m_tree != that.m_tree; } // avl::operator!=() /*----------------------------------------------------------------------------*/ /** * \brief Less than operator. * \param that The instance to compare to. */ template bool claw::avl::operator<( const avl& that ) const { return m_tree < that.m_tree; } // avl::operator<() /*----------------------------------------------------------------------------*/ /** * \brief Greater than operator. * \param that The instance to compare to. */ template bool claw::avl::operator>( const avl& that ) const { return m_tree > that.m_tree; } // avl::operator>() /*----------------------------------------------------------------------------*/ /** * \brief Less or equal operator. * \param that The instance to compare to. */ template bool claw::avl::operator<=( const avl& that ) const { return m_tree <= that.m_tree; } // avl::operator<=() /*----------------------------------------------------------------------------*/ /** * \brief Greater or equal operator. * \param that The instance to compare to. */ template bool claw::avl::operator>=( const avl& that ) const { return m_tree >= that.m_tree; } // avl::operator>=() libclaw-1.7.4/claw/impl/avl_base.tpp000066400000000000000000001557001216507631600173470ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file avl.tpp * \brief The avl class implementation. * \author Julien Jorge */ #include //**************************** avl_base::avl_node ****************************** /*----------------------------------------------------------------------------*/ /** * \brief AVL's node constructor * \param k Value of the node */ template claw::avl_base::avl_node::avl_node( const K& k ) : super(), key(k), balance(0), father(NULL) { assert(!super::left); assert(!super::right); } // avl_node::avl_node() [constructeur] /*----------------------------------------------------------------------------*/ /** * \brief AVL's node destructor */ template claw::avl_base::avl_node::~avl_node() { } // avl_node::~avl_node() [destructeur] /*----------------------------------------------------------------------------*/ /** * \brief Duplicate node and his subtrees. * \param count (out) Count of duplicated nodes. * \remark Count isn't initialized. You should call duplicate with count = 0. */ template typename claw::avl_base::avl_node* claw::avl_base::avl_node::duplicate( unsigned int& count ) const { avl_node* node_copy = new avl_node(key); ++count; node_copy->balance = balance; node_copy->father = NULL; if (super::left) { node_copy->left = super::left->duplicate(count); node_copy->left->father = node_copy; } else node_copy->left = NULL; if (super::right) { node_copy->right = super::right->duplicate(count); node_copy->right->father = node_copy; } else node_copy->right = NULL; return node_copy; } // avl_node::duplicate() /*----------------------------------------------------------------------------*/ /** * \brief Delete current node and his subtrees. * \post left == NULL && right == NULL */ template void claw::avl_base::avl_node::del_tree() { if (super::left) { delete super::left; super::left = NULL; } if (super::right) { delete super::right; super::right = NULL; } assert( !super::left ); assert( !super::right ); } // avl_node::del_tree /*----------------------------------------------------------------------------*/ /** * \brief Get the depth of a tree. * \remark For validity check. * \return 1 + max( this->left->depth(), this->right->depth() ) */ template unsigned int claw::avl_base::avl_node::depth() const { unsigned int pl=0, pr=0; if (super::left) pl = super::left->depth(); if (super::right) pr = super::right->depth(); if (pl > pr) return 1 + pl; else return 1 + pr; } // avl_node::depth() /*----------------------------------------------------------------------------*/ /** * \brief Get a pointer on the node of the tree with a specified key. * \param key Key to find. */ template typename claw::avl_base::avl_node* claw::avl_base::avl_node::find( const K& key ) { bool ok = false; avl_node* node = this; while (node && !ok) if ( avl_base::s_key_less(key, node->key) ) node = node->left; else if ( avl_base::s_key_less(node->key, key) ) node = node->right; else ok = true; return node; } // avl_base::avl_node::find() /*----------------------------------------------------------------------------*/ /** * \brief Get a pointer on the node of the tree with a specified key. * \param key Key to find. */ template const typename claw::avl_base::avl_node* claw::avl_base::avl_node::find( const K& key ) const { bool ok = false; const avl_node* node = this; while (node && !ok) if ( avl_base::s_key_less(key, node->key) ) node = node->left; else if ( avl_base::s_key_less(node->key, key) ) node = node->right; else ok = true; return node; } // avl_base::avl_node::find() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the nodes of the tree on the key imediatly after * from a specified key. * \param key Key to find. */ template typename claw::avl_base::avl_node* claw::avl_base::avl_node::find_nearest_greater( const K& key ) { bool ok = false; avl_node* node = this; avl_node* prev_node = NULL; while (node && !ok) if ( avl_base::s_key_less(key, node->key) ) { prev_node = node; node = node->left; } else if ( avl_base::s_key_less(node->key, key) ) { prev_node = node; node = node->right; } else ok = true; if (ok) return node->next(); else if (prev_node) { if ( avl_base::s_key_less(key, prev_node->key) ) return prev_node->next(); else return prev_node; } else return node; } // avl_base::find_nearest_greater() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the nodes of the tree on the key imediatly after * from a specified key. * \param key Key to find. */ template const typename claw::avl_base::avl_node* claw::avl_base::avl_node::find_nearest_greater( const K& key ) const { bool ok = false; const avl_node* node = this; const avl_node* prev_node = NULL; while (node && !ok) if ( avl_base::s_key_less(key, node->key) ) { prev_node = node; node = node->left; } else if ( avl_base::s_key_less(node->key, key) ) { prev_node = node; node = node->right; } else ok = true; if (ok) return node->next(); else if (prev_node) { if ( avl_base::s_key_less(key, prev_node->key) ) return prev_node->next(); else return prev_node; } else return node; } // avl_base::find_nearest_greater() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the nodes of the tree on the key imediatly before * from a specified key. * \param key Key to find. */ template typename claw::avl_base::avl_node* claw::avl_base::avl_node::find_nearest_lower( const K& key ) { bool ok = false; avl_node* node = this; avl_node* prev_node = NULL; while (node && !ok) if ( s_key_less(key, node->key) ) { prev_node = node; node = node->left; } else if ( s_key_less(node->key, key) ) { prev_node = node; node = node->right; } else ok = true; if (ok) return node->prev(); else if (prev_node) { if ( s_key_less(key, prev_node->key) ) return prev_node; else return prev_node->prev(); } else return node; } // avl_base::find_nearest_lower() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the nodes of the tree on the key imediatly before * from a specified key. * \param key Key to find. */ template const typename claw::avl_base::avl_node* claw::avl_base::avl_node::find_nearest_lower( const K& key ) const { bool ok = false; const avl_node* node = this; const avl_node* prev_node = NULL; while (node && !ok) if ( s_key_less(key, node->key) ) { prev_node = node; node = node->left; } else if ( s_key_less(node->key, key) ) { prev_node = node; node = node->right; } else ok = true; if (ok) return node->prev(); else if (prev_node) { if ( s_key_less(key, prev_node->key) ) return prev_node; else return prev_node->prev(); } else return node; } // avl_base::find_nearest_lower() /*----------------------------------------------------------------------------*/ /** * \brief Get a pointer on the lowest value of the tree. */ template typename claw::avl_base::avl_node* claw::avl_base::avl_node::lower_bound() { avl_node* node = this; if (node) while (node->left) node = node->left; return node; } // avl_base::lower_bound() /*----------------------------------------------------------------------------*/ /** * \brief Get a pointer on the lowest value of the tree. */ template const typename claw::avl_base::avl_node* claw::avl_base::avl_node::lower_bound() const { const avl_node* node = this; if (node) while (node->left) node = node->left; return node; } // avl_base::lower_bound() /*----------------------------------------------------------------------------*/ /** * \brief Get a pointer on the greatest value of the tree. */ template typename claw::avl_base::avl_node* claw::avl_base::avl_node::upper_bound() { avl_node* node = this; if (node) while (node->right) node = node->right; return node; } // avl_base::upper_bound() /*----------------------------------------------------------------------------*/ /** * \brief Get a pointer on the greatest value of the tree. */ template const typename claw::avl_base::avl_node* claw::avl_base::avl_node::upper_bound() const { const avl_node* node = this; if (node) while (node->right) node = node->right; return node; } // avl_base::upper_bound() /*----------------------------------------------------------------------------*/ /** * \brief Get the node immediately greater than \a this. */ template typename claw::avl_base::avl_node* claw::avl_base::avl_node::next() { avl_node* result = this; // node have a right subtree : go to the min if (result->right != NULL) { result = result->right; while (result->left != NULL) result = result->left; } else { bool done = false; avl_node* previous_node = this; // get parent node while (result->father && !done) { if (result->father->left == result) done = true; result = result->father; } // came back from the max node to the root if (!done) result = previous_node; } return result; } // avl_iterator::avl_node::next() /*----------------------------------------------------------------------------*/ /** * \brief Get the node immediately greater than \a this. */ template const typename claw::avl_base::avl_node* claw::avl_base::avl_node::next() const { const avl_node* result = this; // node have a right subtree : go to the min if (result->right != NULL) { result = result->right; while (result->left != NULL) result = result->left; } else { bool done = false; const avl_node* previous_node = this; // get parent node while (result->father && !done) { if (result->father->left == result) done = true; result = result->father; } // came back from the max node to the root if (!done) result = previous_node; } return result; } // avl_iterator::avl_node::next() /*----------------------------------------------------------------------------*/ /** * \brief Get the node immediately before \a this. */ template typename claw::avl_base::avl_node* claw::avl_base::avl_node::prev() { avl_node* result = this; // node have a left subtree : go to the max if (result->left != NULL) { result = result->left; while (result->right != NULL) result = result->right; } else { bool done = false; // get parent node while (result->father && !done) { if (result->father->right == result) done = true; result = result->father; } } return result; } // avl_iterator::avl_node::prev() /*----------------------------------------------------------------------------*/ /** * \brief Get the node immediately before \a this. */ template const typename claw::avl_base::avl_node* claw::avl_base::avl_node::prev() const { const avl_node* result = this; // node have a left subtree : go to the max if (result->left != NULL) { result = result->left; while (result->right != NULL) result = result->right; } else { bool done = false; // get parent node while (result->father && !done) { if (result->father->right == result) done = true; result = result->father; } } return result; } // avl_iterator::avl_node::prev() /*=================================== private ===============================*/ /*----------------------------------------------------------------------------*/ /** * \brief Copy constructor. * \param that Node to copy from. * \remark Shouldn't be use. */ template claw::avl_base::avl_node::avl_node( const avl_node& that ) : super(that), key(that.key), balance(that.balance), father(NULL) { assert(0); } // avl_node::depth() //**************************** avl_base::avl_iterator ************************** /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ template claw::avl_base::avl_iterator::avl_iterator() : m_current(NULL), m_is_final(true) { } // avl_iterator::avl_iterator() [constructeur] /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ template claw::avl_base::avl_iterator::avl_iterator ( avl_node_ptr node, bool final ) : m_current(node), m_is_final(final) { } // avl_iterator::avl_iterator() [constructeur with node] /*----------------------------------------------------------------------------*/ /** * \brief Preincrement. * \pre not final(this). */ template typename claw::avl_base::avl_iterator& claw::avl_base::avl_iterator::operator++() { assert(!m_is_final); assert(m_current); avl_node* p = m_current->next(); if ( m_current == p ) m_is_final = true; else m_current = p; return *this; } // avl_iterator::operator++() [preincrement] /*----------------------------------------------------------------------------*/ /** * \brief Postincrement. */ template typename claw::avl_base::avl_iterator claw::avl_base::avl_iterator::operator++(int) { avl_iterator it = *this; ++(*this); return it; } // avl_iterator::operator++ [postincrement] /*----------------------------------------------------------------------------*/ /** * \brief Predecrement. * \pre iterator is not at the begining of the container. */ template typename claw::avl_base::avl_iterator& claw::avl_base::avl_iterator::operator--() { assert(m_current); if (m_is_final) m_is_final = !m_is_final; else m_current = m_current->prev(); assert(m_current != NULL); return *this; } // avl_iterator::operator--() [predecrement] /*----------------------------------------------------------------------------*/ /** * \brief Postdecrement. */ template typename claw::avl_base::avl_iterator claw::avl_base::avl_iterator::operator--(int) { avl_iterator it = *this; --(*this); return it; } // avl_iterator::operator-- [postdecrement] /*----------------------------------------------------------------------------*/ /** * \brief Dereference. */ template typename claw::avl_base::avl_iterator::reference claw::avl_base::avl_iterator::operator*() const { return m_current->key; } // avl_iterator::operator*() [dereference] /*----------------------------------------------------------------------------*/ /** * \brief Reference. */ template typename claw::avl_base::avl_iterator::pointer claw::avl_base::avl_iterator::operator->() const { return &m_current->key; } // avl_iterator::operator->() /*----------------------------------------------------------------------------*/ /** * \brief Equality. * \param it Iterator to compare to. */ template bool claw::avl_base::avl_iterator::operator==(const avl_iterator& it) const { return (m_current == it.m_current) && (m_is_final == it.m_is_final); } // avl_iterator::operator==() /*----------------------------------------------------------------------------*/ /** * \brief Difference. * \param it Iterator to compare to. */ template bool claw::avl_base::avl_iterator::operator!=(const avl_iterator& it) const { return !( *this == it ); } // avl_iterator::operator!=() //************************* avl_base::avl_const_iterator *********************** /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ template claw::avl_base::avl_const_iterator::avl_const_iterator() : m_current(NULL), m_is_final(true) { } // avl_const_iterator::avl_const_iterator() [constructeur] /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ template claw::avl_base::avl_const_iterator::avl_const_iterator ( const_avl_node_ptr node, bool final ) : m_current(node), m_is_final(final) { } // avl_const_iterator::avl_const_iterator() [constructeur with node] /*----------------------------------------------------------------------------*/ /** * \brief Preincrement. * \pre not final(this). */ template typename claw::avl_base::avl_const_iterator& claw::avl_base::avl_const_iterator::operator++() { assert(!m_is_final); assert(m_current); const_avl_node_ptr p = m_current->next(); if ( m_current == p ) m_is_final = true; else m_current = p; return *this; } // avl_const_iterator::operator++() [preincrement] /*----------------------------------------------------------------------------*/ /** * \brief Postincrement. */ template typename claw::avl_base::avl_const_iterator claw::avl_base::avl_const_iterator::operator++(int) { avl_const_iterator it = *this; ++(*this); return it; } // avl_const_iterator::operator++ [postincrement] /*----------------------------------------------------------------------------*/ /** * \brief Predecrement. * \pre iterator is not at the begining of the container. */ template typename claw::avl_base::avl_const_iterator& claw::avl_base::avl_const_iterator::operator--() { assert(m_current); if (m_is_final) m_is_final = !m_is_final; else m_current = m_current->prev(); assert(m_current != NULL); return *this; } // avl_const_iterator::operator--() [predecrement] /*----------------------------------------------------------------------------*/ /** * \brief Postdecrement. */ template typename claw::avl_base::avl_const_iterator claw::avl_base::avl_const_iterator::operator--(int) { avl_const_iterator it = *this; --(*this); return it; } // avl_const_iterator::operator-- [postdecrement] /*----------------------------------------------------------------------------*/ /** * \brief Dereference. */ template typename claw::avl_base::avl_const_iterator::reference claw::avl_base::avl_const_iterator::operator*() const { return m_current->key; } // avl_const_iterator::operator*() [dereference] /*----------------------------------------------------------------------------*/ /** * \brief Reference. */ template typename claw::avl_base::avl_const_iterator::pointer claw::avl_base::avl_const_iterator::operator->() const { return &m_current->key; } // avl_const_iterator::operator->() /*----------------------------------------------------------------------------*/ /** * \brief Equality. * \param it Iterator to compare to. */ template bool claw::avl_base::avl_const_iterator::operator== (const avl_const_iterator& it) const { return (m_current == it.m_current) && (m_is_final == it.m_is_final); } // avl_const_iterator::operator==() /*----------------------------------------------------------------------------*/ /** * \brief Difference. * \param it Iterator to compare to. */ template bool claw::avl_base::avl_const_iterator::operator!= (const avl_const_iterator& it) const { return !( *this == it ); } // avl_const_iterator::operator!=() //******************************* avl_base (main) ****************************** /*----------------------------------------------------------------------------*/ template typename claw::avl_base::key_less claw::avl_base::s_key_less; /*----------------------------------------------------------------------------*/ /** * \brief AVL constructor. * \post empty() */ template claw::avl_base::avl_base() : m_size(0), m_tree(NULL) { } // avl_base::avl_base() [constructeur] /*----------------------------------------------------------------------------*/ /** * \brief AVL copy constructor. * \param that AVL instance to copy from. */ template claw::avl_base::avl_base( const avl_base& that ) { m_size = 0; if (that.m_tree) m_tree = that.m_tree->duplicate( m_size ); else m_tree = NULL; } // avl_base::avl_base() [copy constructor] /*----------------------------------------------------------------------------*/ /** * \brief AVL destructor. */ template claw::avl_base::~avl_base() { if (m_tree) { m_tree->del_tree(); delete m_tree; } } // avl_base::~avl_base() [destructeur] /*----------------------------------------------------------------------------*/ /** * \brief Add a value in a tree. * \param key Node key. * \post exists(key) */ template void claw::avl_base::insert( const K& key ) { assert( validity_check() ); if ( m_tree == NULL ) { m_tree = new avl_node(key); m_size = 1; } else insert_node(key); assert( validity_check() ); } // avl_base::insert() /*----------------------------------------------------------------------------*/ /** * \brief Add a range of items in the tree. * \param first Iterator on the first item to add. * \param last Iterator past the last item to add. * \pre Iterator::value_type is K * \post exists( *it ) for all it in [first, last) */ template template void claw::avl_base::insert( Iterator first, Iterator last ) { for ( ; first!=last; ++first ) insert( *first ); } // avl_base::insert() /*----------------------------------------------------------------------------*/ /** * \brief Delete a value in a tree. * \param key Node key. * \post not exists(key) */ template void claw::avl_base::erase( const K& key ) { assert( validity_check() ); if (m_tree != NULL) recursive_delete( m_tree, key ); assert( validity_check() ); } // avl_base::erase() /*----------------------------------------------------------------------------*/ /** * \brief Clear a tree. * \post empty() */ template void claw::avl_base::clear() { if (m_tree != NULL) { m_tree->del_tree(); delete m_tree; m_tree = NULL; m_size = 0; } } // avl_base::clear() /*----------------------------------------------------------------------------*/ /** * \brief Get the size of a tree. * \return The size of the tree. */ template inline unsigned int claw::avl_base::size() const { return m_size; } // avl_base::size() /*----------------------------------------------------------------------------*/ /** * \brief Tell if a tree is empty or not. * \return true if the tree is empty, false otherwise. */ template inline bool claw::avl_base::empty() const { return m_size == 0; } // avl_base::empty() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the nodes of the tree. */ template typename claw::avl_base::iterator claw::avl_base::begin() { if (m_tree == NULL) return iterator(NULL, true); else return lower_bound(); } // avl_base::begin() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the nodes of the tree. */ template typename claw::avl_base::const_iterator claw::avl_base::begin() const { if (m_tree == NULL) return const_iterator(NULL, true); else return lower_bound(); } // avl_base::begin() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator after the end of the tree. */ template typename claw::avl_base::iterator claw::avl_base::end() { if (m_tree == NULL) return iterator(NULL, true); else return iterator(m_tree->upper_bound(), true); } // avl_base::end() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator after the end of the tree. */ template typename claw::avl_base::const_iterator claw::avl_base::end() const { if (m_tree == NULL) return const_iterator(NULL, true); else return const_iterator(m_tree->upper_bound(), true); } // avl_base::end() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the nodes of the tree from a specified key. * \param key Key to find. */ template typename claw::avl_base::iterator claw::avl_base::find( const K& key ) { return make_iterator( m_tree->find(key) ); } // avl_base::find() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the nodes of the tree from a specified key. * \param key Key to find. */ template typename claw::avl_base::const_iterator claw::avl_base::find( const K& key ) const { return make_const_iterator( m_tree->find(key) ); } // avl_base::find() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the nodes of the tree on the key imediatly after * from a specified key. * \param key Key to find. */ template typename claw::avl_base::iterator claw::avl_base::find_nearest_greater( const K& key ) { return make_iterator( m_tree->find_nearest_greater(key) ); } // avl_base::find_nearest_greater() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the nodes of the tree on the key imediatly after * from a specified key. * \param key Key to find. */ template typename claw::avl_base::const_iterator claw::avl_base::find_nearest_greater( const K& key ) const { return make_const_iterator( m_tree->find_nearest_greater(key) ); } // avl_base::find_nearest_greater() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the nodes of the tree on the key imediatly before * from a specified key. * \param key Key to find. */ template typename claw::avl_base::iterator claw::avl_base::find_nearest_lower( const K& key ) { return make_iterator( m_tree->find_nearest_lower(key) ); } // avl_base::find_nearest_lower() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the nodes of the tree on the key imediatly before * from a specified key. * \param key Key to find. */ template typename claw::avl_base::const_iterator claw::avl_base::find_nearest_lower( const K& key ) const { return make_const_iterator( m_tree->find_nearest_lower(key) ); } // avl_base::find_nearest_lower() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the lowest value of the tree. */ template typename claw::avl_base::iterator claw::avl_base::lower_bound() { return make_iterator( m_tree->lower_bound() ); } // avl_base::lower_bound() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the lowest value of the tree. */ template typename claw::avl_base::const_iterator claw::avl_base::lower_bound() const { return make_const_iterator( m_tree->lower_bound() ); } // avl_base::lower_bound() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the gratest value of the tree. */ template typename claw::avl_base::iterator claw::avl_base::upper_bound() { return make_iterator( m_tree->upper_bound() ); } // avl_base::upper_bound() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the gratest value of the tree. */ template typename claw::avl_base::const_iterator claw::avl_base::upper_bound() const { return make_const_iterator( m_tree->upper_bound() ); } // avl_base::upper_bound() /*----------------------------------------------------------------------------*/ /** * \brief Assignment operator * \param that AVL instance to copy from. */ template claw::avl_base& claw::avl_base::operator=( const avl_base& that ) { if (this != &that) { if (m_tree) { m_tree->del_tree(); delete m_tree; } m_size = 0; if (that.m_tree) m_tree = that.m_tree->duplicate( m_size ); else m_tree = NULL; } return *this; } // avl_base::operator=() /*----------------------------------------------------------------------------*/ /** * \brief Equality. * \param that AVL top compare to. */ template bool claw::avl_base::operator==( const avl_base& that ) const { if (m_size != that.m_size) return false; else return std::equal( begin(), end(), that.begin(), s_key_less ); } // avl_base::operator==() /*----------------------------------------------------------------------------*/ /** * \brief Disequality. * \param that AVL top compare to. */ template bool claw::avl_base::operator!=( const avl_base& that ) const { return !( *this == that ); } // avl_base::operator!=() /*----------------------------------------------------------------------------*/ /** * \brief Less than operator. * \param that AVL top compare to. */ template bool claw::avl_base::operator<( const avl_base& that ) const { return std::lexicographical_compare ( begin(), end(), that.begin(), that.end(), s_key_less ); } // avl_base::operator<() /*----------------------------------------------------------------------------*/ /** * \brief Greater than operator. * \param that AVL top compare to. */ template bool claw::avl_base::operator>( const avl_base& that ) const { return that < *this; } // avl_base::operator>() /*----------------------------------------------------------------------------*/ /** * \brief Less or equal operator. * \param that AVL top compare to. */ template bool claw::avl_base::operator<=( const avl_base& that ) const { return !( that < *this ); } // avl_base::operator<=() /*----------------------------------------------------------------------------*/ /** * \brief Greater or equal operator. * \param that AVL top compare to. */ template bool claw::avl_base::operator>=( const avl_base& that ) const { return !( *this < that ); } // avl_base::operator>=() /*----------------------------------------------------------------------------*/ /** * \brief Swap the values with an other tree. * \param that The other tree. */ template void claw::avl_base::swap( avl_base& that ) { std::swap(m_size, that.m_size); std::swap(m_tree, that.m_tree); } // avl_base::swap() /*================================= private =================================*/ //----------------------------------------------------------------------------- // We need some methods to check the validity of our trees /*----------------------------------------------------------------------------*/ /** * \brief This method will check order in our trees. * \param node Root of the tree to check. * \param min Lower bound of the valid range for tree's nodes. * \param max Higher bound of the valid range for tree's nodes. * \remark For validity check. * \return true if bounds are ok, false otherwise. */ template bool claw::avl_base::check_in_bounds ( const avl_node_ptr node, const K& min, const K& max ) const { if (node == NULL) return true; else if ( !( s_key_less(node->key, min) || s_key_less(min, node->key) ) ) return (node->left == NULL) && check_in_bounds( node->right, node->key, max ); else if ( !( s_key_less(node->key, max) || s_key_less(max, node->key) ) ) return (node->right == NULL) && check_in_bounds( node->left, min, node->key ); else return s_key_less(node->key, max) && s_key_less(min, node->key) && check_in_bounds( node->left, min, node->key ) && check_in_bounds( node->right, node->key, max ); } // check_less_than() /*----------------------------------------------------------------------------*/ /** * \brief This method will check balance in our trees. * \param node Root of the tree to check. * \remark For validity check. * \return true if the absolute difference between left subtree's depth and * right subtree's depth is 1 for node and each of its subtrees. * false otherwise. */ template bool claw::avl_base::check_balance( const avl_node_ptr node ) const { int pl=0, pr=0; if (node == NULL) return true; else { if (node->left) pl = node->left->depth(); if (node->right) pr = node->right->depth(); return (pl-pr>=-1) && (pl-pr<=1) && (pl-pr == node->balance) && check_balance(node->left) && check_balance(node->right); } } // check_balance() /*----------------------------------------------------------------------------*/ /** * \brief This method will check if each node is a son of his father. * \param node Node to check. * \remark For validity check. * \return true if the AVL is valid, false otherwise. */ template bool claw::avl_base::correct_descendant( const avl_node_ptr node ) const { bool valid = true; if (node != NULL) { if (node->father != NULL) { valid = (node->father->left == node) ^ (node->father->right == node); valid = valid && correct_descendant( node->left ) && correct_descendant( node->right ); } else valid = false; } return valid; } // correct_descendant() /*----------------------------------------------------------------------------*/ /** * \brief This method will check orderliness in our trees : balance and order. * * \remark For validity check. * \return true if the AVL is valid, false otherwise. */ template bool claw::avl_base::validity_check() const { bool valid = true; if (m_tree != NULL) { avl_node *node_min, *node_max; // get lower and higher bounds, hope they are correct for (node_min = m_tree; node_min->left!=NULL; node_min = node_min->left); for (node_max = m_tree; node_max->right!=NULL; node_max = node_max->right); valid = check_in_bounds(m_tree->left, node_min->key, m_tree->key); valid = valid && check_in_bounds(m_tree->right, m_tree->key, node_max->key); valid = valid && (m_tree->father == NULL) && correct_descendant( m_tree->left ) && correct_descendant( m_tree->right ); } return valid && check_balance(m_tree); } // validity_check() /*----------------------------------------------------------------------------*/ /** * \brief Create an iterator from a pointer to a node. * \param node The node on which we want the iterator. */ template typename claw::avl_base::iterator claw::avl_base::make_iterator( avl_node_ptr node ) const { if (node != NULL) return iterator(node, false); else return end(); } // avl_base::make_iterator() /*----------------------------------------------------------------------------*/ /** * \brief Create an iterator from a pointer to a node. * \param node The node on which we want the iterator. */ template typename claw::avl_base::const_iterator claw::avl_base::make_const_iterator( const_avl_node_ptr node ) const { if (node != NULL) return const_iterator(node, false); else return end(); } // avl_base::make_const_iterator() //----------------------------------------------------------------------------- // Tree management methods /*----------------------------------------------------------------------------*/ /** * \brief Node right rotation * \param node Node to rotate. * \pre (node != NULL) && node->left != NULL * \pre node->balance in [1,2] and node->left->balance in [-1,2] * \pre (node->left->balance == 2) ==> (node->balance == 2) */ template void claw::avl_base::rotate_right( avl_node_ptr& node ) { avl_node_ptr p; char old_node_balance; char old_subtree_balance; assert( node != NULL ); assert( node->left != NULL ); assert( (1 <= node->balance) && (node->balance <= 2) ) ; assert( (-1 <= node->left->balance) && (node->left->balance <= 2) ); assert( (node->left->balance != 2) || (node->balance == 2) ); old_node_balance = node->balance; old_subtree_balance = node->left->balance; // rotate nodes p = node->left; p->father = node->father; node->left = p->right; if (p->right) p->right->father = node; p->right = node; node->father = p; node = p; // adjust balance switch(old_subtree_balance) { case -1 : node->balance = -2; node->right->balance = old_node_balance - 1; break; case 0 : node->balance = -1; node->right->balance = old_node_balance - 1; break; case 1 : node->balance = old_node_balance - 2; node->right->balance = old_node_balance - 2; break; case 2 : // old_node_balance is 2 too. node->balance = 0; node->right->balance = - 1; break; } } // rotate_right() /*----------------------------------------------------------------------------*/ /** * \brief Node left rotation * \param node Node to rotate. * \pre (node != NULL) && node->right != NULL * \pre node->balance in [-2,-1] and node->right->balance in [-2,1] * \pre (node->right->balance == -2) ==> (node->balance == -2) */ template void claw::avl_base::rotate_left( avl_node_ptr& node ) { avl_node_ptr p; char old_node_balance; char old_subtree_balance; assert( node != NULL ); assert( node->right != NULL ); assert( (-2 <= node->balance) && (node->balance <= -1) ) ; assert( (-2 <= node->right->balance) && (node->right->balance <= 1) ); assert( (node->right->balance != -2) || (node->balance == -2) ); old_node_balance = node->balance; old_subtree_balance = node->right->balance; // rotate nodes p = node->right; p->father = node->father; node->right = p->left; if (p->left) p->left->father = node; p->left = node; node->father = p; node = p; // adjust balance switch(old_subtree_balance) { case -2 : // old_node_balance is -2 too. node->balance = 0; node->left->balance = 1; break; case -1 : node->balance = old_node_balance + 2; node->left->balance = old_node_balance + 2; break; case 0 : node->balance = 1; node->left->balance = old_node_balance + 1; break; case 1 : node->balance = 2; node->left->balance = old_node_balance + 1; break; } } // rotate_left() /*----------------------------------------------------------------------------*/ /** * \brief Node left-right rotation * \param node Node to rotate. */ template void claw::avl_base::rotate_left_right( avl_node_ptr& node ) { assert( node != NULL ); rotate_left( node->left ); rotate_right( node ); } // rotate_left_right() /*----------------------------------------------------------------------------*/ /** * \brief Node right-left rotation * \param node Node to rotate. */ template void claw::avl_base::rotate_right_left( avl_node_ptr& node ) { assert( node != NULL ); rotate_right( node->right ); rotate_left( node ); } // rotate_right_left() /*----------------------------------------------------------------------------*/ /** * \brief Update balance of each node by increasing depth of the substree * containing key, from node to the node key. * \param node Root of the subtree to update. * \param key Key of the just-added node. * \pre (node != NULL) && ( key is in the tree starting from root node ) * \post balance is ok for each node from node to key */ template void claw::avl_base::update_balance( avl_node_ptr node, const K& key ) { assert(node != NULL); bool done = false; while (!done) if ( s_key_less(key, node->key) ) { ++node->balance; node = node->left; } else if ( s_key_less(node->key, key) ) { --node->balance; node = node->right; } else done = true; } // update_balance() /*----------------------------------------------------------------------------*/ /** * \brief Adjust balance of a node so it will be in range [-1;1]. * \param node Node to adjust. * \pre (node != NULL). * \post node->balance is in range [-1;1] */ template void claw::avl_base::adjust_balance( avl_node_ptr& node ) { assert(node != NULL); if ( node->balance == 2) adjust_balance_left(node); else if ( node->balance == -2) adjust_balance_right(node); } // adjust_balance() /*----------------------------------------------------------------------------*/ /** * \brief Adjust balance of a node leaning on the left so it will be * in range [-1;1]. * \param node Node to adjust. * \pre (node != NULL) && (*node != NULL) && ( (*node)->balance == 2). * \post node->balance is in range [-1;1] */ template void claw::avl_base::adjust_balance_left( avl_node_ptr& node ) { assert(node != NULL); assert(node->balance == 2); if (node->left->balance > -1) rotate_right( node ); else if ( node->left->balance == -1) rotate_left_right(node); } // adjust_balance_left() /*----------------------------------------------------------------------------*/ /** * \brief Adjust balance of a node leaning on the right so it will be * in range [-1;1]. * \param node Node to adjust. * \pre (node != NULL) && (*node != NULL) && ( (*node)->balance == -2). * \post node->balance is in range [-1;1] */ template void claw::avl_base::adjust_balance_right( avl_node_ptr& node ) { assert(node != NULL); assert(node->balance == -2); if (node->right->balance < 1) rotate_left( node ); else if ( node->right->balance == 1) rotate_right_left(node); } // adjust_balance_right() /*----------------------------------------------------------------------------*/ // Methods for insertion /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** * \brief Add a node to the tree. * \param key Key for the new value. * \post exists(key) * && (exists(old this, key)==0 => size(this) == size(old this) + 1 ) */ template void claw::avl_base::insert_node( const K& key ) { avl_node_ptr* new_node; avl_node_ptr node_father; avl_node_ptr last_imbalanced; avl_node_ptr last_imbalanced_father; assert(m_tree != NULL); new_node = find_node_reference(key, last_imbalanced, node_father ); if (*new_node == NULL) // this key isn't in use. Let's create a new node { *new_node = new avl_node(key); (*new_node)->father = node_father; ++m_size; last_imbalanced_father = last_imbalanced->father; // Update balance of the last imbalanced node update_balance( last_imbalanced, key ); // then adjust it to be in range [-1, 1] adjust_balance( last_imbalanced ); // pointer update after rotation if ( last_imbalanced_father == NULL ) { m_tree = last_imbalanced; m_tree->father = NULL; } else if (s_key_less(last_imbalanced->key, last_imbalanced_father->key)) // left child last_imbalanced_father->left = last_imbalanced; else last_imbalanced_father->right = last_imbalanced; } } // insert_node() /*----------------------------------------------------------------------------*/ /** * \brief Find the node where to insert a new value at key. * \param key Key for the new value. * \param last_imbalanced (out) Pointer to the last imbalanced node seen. * \param node_father (out) Pointer to the father of the new node. * \return Pointer to the node corresponding of the key (if exists). Otherwise * a pointer to a NULL node where to insert the new one. * \post ( exists(this, key) => *result == find(this, key) ) * && ( !exists(this, key) => *result the good node to allocate ) * && ( *last_imbalance and *last_imbalance are correct regarding to * previous definitions ) */ template typename claw::avl_base::avl_node_ptr* claw::avl_base::find_node_reference ( const K& key, avl_node_ptr& last_imbalanced, avl_node_ptr& node_father) { avl_node_ptr* node; // node for search bool exists = false; // if this key already exists last_imbalanced = m_tree; node = & m_tree; node_father = NULL; while ( ((*node) != NULL) && !exists ) { if ( (*node)->balance != 0 ) last_imbalanced = *node; // find next node if ( s_key_less(key, (*node)->key) ) { node_father = *node; node = & (*node)->left; } else if ( s_key_less((*node)->key, key) ) { node_father = *node; node = & (*node)->right; } else exists = true; } return node; } // find_node_reference() /*----------------------------------------------------------------------------*/ // Methods for deletion /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /** * \brief Delete a node. Search is done recursively. * \param node Tree to which the node is removed. * \param key Key of the node to remove. * \return true if the balance of the node has changed. * \pre node != NULL * \post (exists(this, key) == 0) */ template bool claw::avl_base::recursive_delete( avl_node_ptr& node, const K& key ) { bool result = false; if ( node != NULL ) { // try to find the key in the left subtree if ( s_key_less(key, node->key) ) { if ( recursive_delete( node->left, key ) ) result = new_balance( node, -1 ); } // try to find the key in the right subtree else if ( s_key_less(node->key, key) ) { if ( recursive_delete( node->right, key ) ) result = new_balance( node, 1 ); } else // we got it ! { --m_size; result = recursive_delete_node( node ); } } return result; } // recursive_delete() /*----------------------------------------------------------------------------*/ /** * \brief Adjust balance of a node. * \param node Node to balance. * \param imbalance Imbalance to add to the node's balance. * \return true if the balance of the node has changed. * \pre node != NULL * \pre (imbalance==1) || (imbalance==-1) * \post node tree is an AVL */ template bool claw::avl_base::new_balance( avl_node_ptr& node, int imbalance ) { assert( (imbalance==1) || (imbalance==-1) ); assert( node != NULL ); node->balance += imbalance; switch(node->balance) { // balance == 0 so as it was != 0 before deletion // balance of the tree had changed case 0: return true; // balance == 2 so it must be 1 before deletion and node // was deleted in the right subtree // if after ajusting the balance is equal to 1, it means that // our subtree got back his old balance (so it's unchanged). // if it's equal to -1, it means that subtree now lean to the // otherside. But in those cases, depth didn't changed. case 2: adjust_balance_left(node); return node->balance == 0; // same thing but symetric case -2: adjust_balance_right(node); return node->balance == 0; default : return false; } } // new_balance() /*----------------------------------------------------------------------------*/ /** * \brief Remove the root of an AVL * (exchange with the descendant immediatly lower). * \param node Node to remove. * \return true if the balance of the subtree has changed. * \pre node != NULL * \post node tree is an AVL */ template bool claw::avl_base::recursive_delete_node( avl_node_ptr& node ) { assert( node != NULL ); if ( node->left == NULL) // this node doesn't have a lower descendant { // Get right subtree of current node avl_node_ptr right_subtree = node->right; if (right_subtree) right_subtree->father = node->father; // Free memory pointed by the current node node->clear(); delete node; // then rise the old right subtree node = right_subtree; return true; } else // this node has a lower descendant, let's get it if ( recursive_delete_max( node->left, node ) ) { // left subtree depth has decreased // so reajust balance (rem. balance is not changed by delete_max) --(node->balance); if ( node->balance == -2 ) { // old balance was -1 adjust_balance_right(node); return node->balance == 0; // tell if depth has changed } else if ( node->balance == 0 ) // node had at least one subtree and old balance - 1 == 0 // so old balance = 1 return true; else // node's balance is -1 // As node's balance is (old balance - 1), node's balance must be -1 // (otherwise old balance is 2, that's impossible) // So old balance is 0. // Moreover old node have at least a left subtree. It means that // old node had 2 subtrees and their depths were equals. // It means bstn_depth(old node) == bstn_depth((old node)->right) + 1 // We deleted a node in left subtree and so right subtree is // unchanged. So bstn_depth(node) == bstn_depth(node->right) + 1 // == bstn_depth( (old node)->right) ) + 1 == bstn_depth(old node) // => Node depth is unchanged. return false; } else // depth is unchanged return false; } // recursive_delete_node() /*----------------------------------------------------------------------------*/ /** * \brief Replace a node key and data by the one of the node with the * maximum key in tree. * \param root Root of the tree in which find new values. * \param node Node Wich gets values founded * \return true if the balance of the tree from root has changed. * \pre node != NULL * \pre root != NULL * \pre root is an AVL * \post (root tree is an AVL) && (find(root, max(old root)) == 0) */ template int claw::avl_base::recursive_delete_max ( avl_node_ptr& root, avl_node_ptr node ) { assert(node!=NULL); assert(root!=NULL); if ( root->right == NULL ) // We have the maximum { // node have only a left subtree if any. // This subtree has one node, at most. avl_node_ptr left_subtree; node->key = root->key; left_subtree = root->left; if (left_subtree) left_subtree->father = root->father; root->clear(); delete root; // rise the left subtree root = left_subtree; // depth have changed return true; } else // try to find the max in the right subtree if ( recursive_delete_max( root->right, node ) ) { // depth of the subtree changed (ie. decreased) // so root's tree lean to the left ++(root->balance); if (root->balance == 2) // tree is leaning too much { // old balance was 1 adjust_balance_left( root ); return root->balance == 0; // Say if balance is changed } else // if balance is 0, it means that old root leant to the left // and so his depth changed. // The other value for balance is 1, in this case // depth didn't change. See recursive_delete_node code comments. return root->balance == 0; } else // depth of the subtree didn't change return false; } // recursive_delete_max() libclaw-1.7.4/claw/impl/basic_singleton.tpp000066400000000000000000000034341216507631600207320ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file basic_singleton.tpp * \brief Implementation of the claw::pattern::basic_singleton class. * \author Julien Jorge */ /*----------------------------------------------------------------------------*/ /** * \brief Get the instance of the singleton. */ template T& claw::pattern::basic_singleton::get_instance() { static T single_instance; return single_instance; } // basic_singleton::get_instance() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ template claw::pattern::basic_singleton::basic_singleton() { } // basic_singleton::basic_singleton() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ template claw::pattern::basic_singleton::~basic_singleton() { } // basic_singleton::~basic_singleton() libclaw-1.7.4/claw/impl/basic_socketbuf.tpp000066400000000000000000000233711216507631600207170ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file basic_socketbuf.tpp * \brief Implantation of the claw::net::basic_socketbuf class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ template const size_t claw::net::basic_socketbuf::s_buffer_size = 256; /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param read_limit Number of second to wait before considering nothing will * come in the socket. Negative values mean infinity. * \post is_open() == false; */ template claw::net::basic_socketbuf::basic_socketbuf( int read_limit ) : m_read_limit(read_limit), m_input_buffer(NULL), m_input_buffer_size(0), m_output_buffer(NULL), m_output_buffer_size(0) { create_buffers(); } // basic_socketbuf::basic_socketbuf() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ template claw::net::basic_socketbuf::~basic_socketbuf() { close(); destroy_buffers(); } // basic_socketbuf::basic_socketbuf() /*----------------------------------------------------------------------------*/ /** * \brief Initialise the socket. * \param address Address to open. * \param port The port to connect to. * \return this if everything works fine, NULL otherwise. */ template typename claw::net::basic_socketbuf::self_type* claw::net::basic_socketbuf::open ( const std::string& address, int port ) { self_type* result = NULL; if (!this->is_open()) if ( basic_socket::open() ) { if ( connect( address, port ) ) result = this; else close(); } return result; } // basic_socketbuf::open() /*----------------------------------------------------------------------------*/ /** * \brief Link the socket to a file descriptor. * \param d The file descriptor. * \return this if everything works fine, NULL otherwise. * \remark This method should be only called by claw::net::basic_*socket_stream. * \remark If this socket was open and \a fd is valid, the socket will be closed * before that \a d will be assigned. */ template typename claw::net::basic_socketbuf::self_type* claw::net::basic_socketbuf::open( socket_traits::descriptor d ) { self_type* result = NULL; if ( socket_traits::is_open(d) ) { if (this->is_open()) { if ( close() ) { result = this; m_descriptor = d; } } else { result = this; m_descriptor = d; } } return result; } // basic_socketbuf::open() /*----------------------------------------------------------------------------*/ /** * \brief Close the socket. * \post is_open() == false; */ template typename claw::net::basic_socketbuf::self_type* claw::net::basic_socketbuf::close() { if ( basic_socket::close() ) return this; else return NULL; } // basic_socketbuf::close() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the socket is open. */ template bool claw::net::basic_socketbuf::is_open() const { return basic_socket::is_open(); } // // basic_socketbuf::is_open() /*----------------------------------------------------------------------------*/ /** * \brief Set the number of second to wait before considering nothing will come * in the socket. * \param read_limit The number of seconds. Negative values mean infinity. */ template void claw::net::basic_socketbuf::set_read_time_limit ( int read_limit ) { m_read_limit = read_limit; } // // basic_socketbuf::set_read_time_limit() /*----------------------------------------------------------------------------*/ /** * \brief Write the buffered data in the socket. * \pre is_open() */ template int claw::net::basic_socketbuf::sync() { CLAW_PRECOND( is_open() ); CLAW_PRECOND( buffered() ); ssize_t write_count = 0; ssize_t length = (this->pptr() - this->pbase()) * sizeof(char_type); int_type result = 0; if ( length > 0 ) write_count = send(m_descriptor, static_cast(this->pbase()), length, 0 ); if ( write_count >= 0 ) this->setp( m_output_buffer, m_output_buffer + m_output_buffer_size ); else result = -1; return result; } // basic_socketbuf::sync() /*----------------------------------------------------------------------------*/ /** * \brief Fill the input buffer. * \pre is_open() && gptr() != NULL * \return The next symbol to be read ( *gptr() ) if there is data coming from * the socket, traits::eof() otherwise. */ template typename claw::net::basic_socketbuf::int_type claw::net::basic_socketbuf::underflow() { CLAW_PRECOND( buffered() ); CLAW_PRECOND( this->gptr() >= this->egptr() ); ssize_t read_count; ssize_t length = m_input_buffer_size * sizeof(char_type); int_type result = traits_type::eof(); if( !is_open() ) return result; if ( socket_traits::select_read(m_descriptor, m_read_limit) ) read_count = recv(m_descriptor, static_cast(m_input_buffer), length, 0); else read_count = -1; if ( read_count > 0 ) { this->setg( m_input_buffer, m_input_buffer, m_input_buffer + read_count); result = this->sgetc(); } else this->setg( m_input_buffer, m_input_buffer + m_input_buffer_size, m_input_buffer + m_input_buffer_size ); return result; } // basic_socketbuf::underflow() /*----------------------------------------------------------------------------*/ /** * \brief Synchronize the output buffer (ie. write in the socket). * \param c */ template typename claw::net::basic_socketbuf::int_type claw::net::basic_socketbuf::overflow( int_type c ) { CLAW_PRECOND( is_open() ); CLAW_PRECOND( buffered() ); int_type result = traits_type::eof(); if ( sync() == 0 ) { result = traits_type::not_eof(c); if ( !traits_type::eq_int_type(c, traits_type::eof()) ) this->sputc(c); } return result; } // basic_socketbuf::overflow() /*----------------------------------------------------------------------------*/ /** * \brief Connect the socket to a port. * \param addr The address to connect to. * \param port The port to connect to. * \return true if the connection is established. * \pre m_fd is a valid socket descriptor. */ template bool claw::net::basic_socketbuf::connect ( const std::string& addr, int port ) { CLAW_PRECOND( socket_traits::valid_descriptor(m_descriptor) ); return socket_traits::connect(m_descriptor, addr, port); } // basic_socketbuf::connect() /*----------------------------------------------------------------------------*/ /** * \brief Create the buffers. * \pre pbase() == eback() == NULL */ template void claw::net::basic_socketbuf::create_buffers() { CLAW_PRECOND( this->pbase() == NULL ); CLAW_PRECOND( this->eback() == NULL ); m_input_buffer_size = m_output_buffer_size = s_buffer_size; m_input_buffer = new char_type[m_input_buffer_size]; m_output_buffer = new char_type[m_output_buffer_size]; this->setg( m_input_buffer, m_input_buffer + m_input_buffer_size, m_input_buffer + m_input_buffer_size ); this->setp( m_output_buffer, m_output_buffer + m_output_buffer_size ); } // basic_socketbuf::create_buffers() /*----------------------------------------------------------------------------*/ /** * \brief Destroy the buffers. * \post pbase() == eback() == NULL */ template void claw::net::basic_socketbuf::destroy_buffers() { if ( m_input_buffer ) { delete[] m_input_buffer; m_input_buffer = NULL; } if ( m_output_buffer ) { delete[] m_output_buffer; m_output_buffer = NULL; } this->setg( NULL, NULL, NULL ); this->setp( NULL, NULL ); } // basic_socketbuf::destroy_buffers() /*----------------------------------------------------------------------------*/ /** * \brief Tell if we use buffered input and output. * \remark Should always be true ! */ template bool claw::net::basic_socketbuf::buffered() const { return this->pbase() && this->pptr() && this->epptr() && this->eback() && this->gptr() && this->egptr(); } // basic_socketbuf::buffered() libclaw-1.7.4/claw/impl/binary_node.tpp000066400000000000000000000045051216507631600200600ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file binary_node.tpp * \brief The binary_node class implementation. * \author Julien Jorge */ #include /*---------------------------------------------------------------------------*/ /** * \brief Binary node constructor. * \post (left==NULL) && (right==NULL) */ template< class U > claw::binary_node::binary_node() : left(NULL), right(NULL) { } //binary_node() /*---------------------------------------------------------------------------*/ /** * \brief Binary node copy constructor. * \param that Node to copy from. */ template< class U > claw::binary_node::binary_node( const binary_node& that ) { if (that.left) left = new U( * that.left ); else left = NULL; if ( that.right ) right = new U( * that.right ); else right = NULL; } // binary_node() [copy constructor] /*---------------------------------------------------------------------------*/ /** * \brief Clear right and left childs. Memory's not freed. * \post this->left == NULL && this->right == NULL */ template< class U > void claw::binary_node::clear() { left = NULL; right = NULL; } // clear() /*---------------------------------------------------------------------------*/ /** * \brief Binary node destructor. * Deletes the whole subtree. */ template< class U > claw::binary_node::~binary_node() { if (left) delete left; if (right) delete right; } // ~binary_node() [destructor] libclaw-1.7.4/claw/impl/bit_istream.tpp000066400000000000000000000054211216507631600200670ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file bit_istream.tpp * \brief Implementation of the claw::bit_istream class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param f The stream in which we read. */ template claw::bit_istream::bit_istream( stream_type& f ) : m_stream(f), m_pending(0), m_pending_length(0) { } // bit_istream::bit_istream() /*----------------------------------------------------------------------------*/ /** * \brief Read some bits. * \param buf A buffer in which we write the bits. * \param n The number of bits to read. */ template void claw::bit_istream::read( char* buf, unsigned int n ) { if ( n == 0 ) return; unsigned int cur_size = 0; while ( (n != 0) && !!(*this) ) { while( (m_pending_length != 0) && (n!=0) && !!(*this) ) { unsigned int bits = std::min((unsigned int)m_pending_length, n); if ( CHAR_BIT - cur_size < bits ) bits = CHAR_BIT - cur_size; unsigned int mask = (1 << bits) - 1; *buf |= (m_pending & mask) << cur_size; cur_size += bits; m_pending_length -= bits; m_pending >>= bits; n -= bits; if ( cur_size == CHAR_BIT ) { ++buf; cur_size = 0; } } if ( m_pending_length == 0 ) if ( m_stream.read( (char*)&m_pending, sizeof(m_pending) ) ) m_pending_length = CHAR_BIT; } } // bit_istream::read() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the input stream is still valid. */ template claw::bit_istream::operator bool() const { return m_stream || (m_pending_length > 0); } // bit_istream::operator bool() libclaw-1.7.4/claw/impl/bit_ostream.tpp000066400000000000000000000056271216507631600201050ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file bit_ostream.tpp * \brief Implementation of the claw::bit_ostream class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param f The stream in which we write. */ template claw::bit_ostream::bit_ostream( stream_type& f ) : m_stream(f), m_pending(0), m_pending_length(0) { } // bit_ostream::bit_ostream() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ template claw::bit_ostream::~bit_ostream() { if (m_pending_length != 0) m_stream.write( (char*)&m_pending, sizeof(m_pending) ); } // bit_ostream::~bit_ostream() /*----------------------------------------------------------------------------*/ /** * \brief Write some bits. * \param buf A buffer from which we read the bits. * \param n The number of bits to write. */ template void claw::bit_ostream::write( const char* buf, unsigned int n ) { if ( n == 0 ) return; unsigned int cur_size = 0; unsigned char data = *buf; while ( n != 0 ) { while( (m_pending_length != CHAR_BIT) && (n!=0) ) { unsigned int bits = std::min(CHAR_BIT - (unsigned int)m_pending_length, n); if ( CHAR_BIT - cur_size < bits ) bits = CHAR_BIT - cur_size; unsigned int mask = (1 << bits) - 1; m_pending |= (data & mask) << m_pending_length; cur_size += bits; m_pending_length += bits; data >>= bits; n -= bits; if ( (cur_size == CHAR_BIT) && (n!=0) ) { ++buf; cur_size = 0; data = *buf; } } if ( m_pending_length == CHAR_BIT ) { m_stream.write( (char*)&m_pending, sizeof(m_pending) ); m_pending = 0; m_pending_length = 0; } } } // bit_ostream::write() libclaw-1.7.4/claw/impl/bitmap_reader.tpp000066400000000000000000000131461216507631600203660ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file bitmap_reader.tpp * \brief Template classes of the claw::graphic::bitmap::reader class. * \author Julien Jorge */ #include #include #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param palette The color palette to convert the pixels. * \param img The image we're filling. */ template< bool Coded4Bits > claw::graphic::bitmap::reader:: rle_bitmap_output_buffer::rle_bitmap_output_buffer ( const color_palette_type& palette, image& img ) : m_palette(palette), m_image(img), m_x(0), m_y(m_image.height() - 1) { } // bitmap::reader::rle_bitmap_output_buffer::rle_bitmap_output_buffer() /*----------------------------------------------------------------------------*/ /** * \brief Go to the begining of the next line to fill. */ template< bool Coded4Bits > void claw::graphic::bitmap::reader:: rle_bitmap_output_buffer::next_line() { assert( m_y > 0 ); m_x = 0; --m_y; } // bitmap::reader::rle_bitmap_output_buffer::next_line() /*----------------------------------------------------------------------------*/ /** * \brief Move the cursor horizontally and vertically. * \param x Horizontal displacement. * \param y Vertical displacement. */ template< bool Coded4Bits > void claw::graphic::bitmap::reader:: rle_bitmap_output_buffer::delta_move (unsigned char x, unsigned char y) { assert( m_x + x < m_image.width() ); assert( m_y + y < m_image.height() ); m_x += x; m_y += y; } // bitmap::reader::rle_bitmap_output_buffer::delta_move() //****************************************************************************** /*----------------------------------------------------------------------------*/ /** * \brief Get the type of the following data in the input buffer, eventually * apply the special codes. * \param input The input stream (the bitmap file). * \param output The output stream (the bitmap image). */ template< typename OutputBuffer > void claw::graphic::bitmap::reader::rle_bitmap_decoder::read_mode ( file_input_buffer& input, output_buffer_type& output) { this->m_mode = this->stop; bool ok = true; if ( input.remaining() < 2) ok = input.read_more(2); if (ok) { unsigned char key, pattern; key = input.get_next(); pattern = input.get_next(); // compressed data, next byte is the pattern if (key > 0) { this->m_mode = this->compressed; this->m_count = key; this->m_pattern = pattern; } else switch( pattern ) { // end of line case 0 : output.next_line(); read_mode(input, output); break; // end of file case 1 : this->m_mode = this->stop; break; // delta move case 2 : { if ( input.remaining() < 1 ) ok = input.read_more(1); if (ok) { unsigned char x, y; x = pattern; y = input.get_next(); output.delta_move(x, y); read_mode(input, output); break; } } // raw data default: this->m_mode = this->raw; this->m_count = pattern; break; } } } // bitmap::reader::rle_bitmap_decoder::read_mode() /*----------------------------------------------------------------------------*/ /** * \brief Load uncompressed data from the file. * \param f The file from which we're loading the bitmap. * \param buffer_size Number of bytes needed to store one line of pixels. * \param palette Color palette. * \param pixel_convert A method to convert one line of pixels from the file to * a line of the current bitmap. * * \remark The Convert type method must take this four parameters in this order: * # scanline& destination line, * # const char* input buffer (contains one line of the bitmap), * # const color_palette_type& palette The color palette of the file, */ template void claw::graphic::bitmap::reader::load_rgb_data ( std::istream& f, unsigned int buffer_size, const color_palette_type& palette, const Convert& pixel_convert ) { unsigned int line; // lines are 4-bytes aligned, so adjust buffer's size. if (buffer_size % 4 != 0) buffer_size += 4 - buffer_size % 4; char* buffer = new char[buffer_size]; for (line = m_image.height(); (line>0) && !f.eof(); ) { --line; f.read(buffer, buffer_size); pixel_convert( m_image[line], buffer, palette ); } delete[] buffer; if ( f.rdstate() != std::ios_base::goodbit ) throw claw::bad_format("bitmap::reader::load_data"); } // bitmap::reader::load_data() libclaw-1.7.4/claw/impl/box_2d.tpp000066400000000000000000000410441216507631600167430ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file box_2d.tpp * \brief Implementation of claw::math::box_2d class. * \author Julien Jorge */ #include #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ template claw::math::box_2d::box_2d() { } // box_2d::box_2d() [constructor] /*----------------------------------------------------------------------------*/ /** * \brief Copy constructor. * \param that Box to copy from. */ template claw::math::box_2d::box_2d( const self_type& that ) : first_point(that.first_point), second_point(that.second_point) { } // box_2d::box_2d() [copy constructor] /*----------------------------------------------------------------------------*/ /** * \brief Constructor from a rectangle. * \param that Rectangle to copy from. */ template claw::math::box_2d::box_2d( const rectangle& that ) : first_point(that.position), second_point(that.right(), that.bottom()) { } // box_2d::box_2d() [constructor from rectangle] /*----------------------------------------------------------------------------*/ /** * \brief Constructor from two points. * \param p1 The first point. * \param p2 The second point. */ template claw::math::box_2d::box_2d( const point_type& p1, const point_type& p2 ) : first_point(p1), second_point(p2) { } // box_2d::box_2d() [constructor from coordinates] /*----------------------------------------------------------------------------*/ /** * \brief Constructor with initialization. * \param x1 X-coordinate of the first point. * \param y1 Y-coordinate of the first point. * \param x2 X-coordinate of the second point. * \param y2 Y-coordinate of the second point. */ template claw::math::box_2d::box_2d( const value_type& x1, const value_type& y1, const value_type& x2, const value_type& y2 ) : first_point(x1, y1), second_point(x2, y2) { } // box_2d::box_2d() [constructor with values] /*----------------------------------------------------------------------------*/ /** * \brief Set the coordinates of the two points. * \param x1 X-coordinate of the first point. * \param y1 Y-coordinate of the first point. * \param x2 X-coordinate of the second point. * \param y2 Y-coordinate of the second point. */ template void claw::math::box_2d::set ( const value_type& x1, const value_type& y1, const value_type& x2, const value_type& y2 ) { first_point.set(x1, y1); second_point.set(x2, y2); } // box_2d::set() /*----------------------------------------------------------------------------*/ /** * \brief Get a copy of the box by converting its members to a given type. * * Consider the following code: * * box_2d a; * * ... * * box_2d b(a); * * The copy constructor will be called, and your compiler should print some * warnings in your console. These warnings have a meaning, so we don't wan't to * make them disapear by adding explicit type conversion inside the box_2d * class nor adding a cast operator that will be used silently by the compiler. * * If you really want to convert the type, this method will explicitly cast the * member variables. */ template template claw::math::box_2d claw::math::box_2d::cast_value_type_to() const { return claw::math::box_2d ( first_point.cast_value_type_to(), second_point.cast_value_type_to() ); } // box_2d::cast_value_type_to() /*----------------------------------------------------------------------------*/ /** * \brief Calculate the box's area. */ template typename claw::math::box_2d::value_type claw::math::box_2d::area() const { return width() * height(); } // box_2d::area() /*----------------------------------------------------------------------------*/ /** * \brief Tell if a point is in a box. * \param p The supposed included point. */ template bool claw::math::box_2d::includes( const coordinate_2d& p ) const { return (left() <= p.x) && (right() >= p.x) && (bottom() <= p.y) && (top() >= p.y); } // box_2d::includes() /*----------------------------------------------------------------------------*/ /** * \brief Tell if a box_2d is in a box_2d. * \param r The supposed included box_2d. */ template bool claw::math::box_2d::includes( const self_type& r ) const { return includes(r.first_point) && includes(r.second_point); } // box_2d::includes() /*----------------------------------------------------------------------------*/ /** * \brief Tell if there is an intersection of two boxes. * \param r The supposed intersecting box. */ template bool claw::math::box_2d::intersects( const self_type& r ) const { return (right() >= r.left()) && (r.right() >= left()) && (top() >= r.bottom()) && (r.top() >= bottom()); } // box_2d::intersects() /*----------------------------------------------------------------------------*/ /** * \brief Intersection of two box_2ds. * \param r The supposed intersecting box_2d. */ template claw::math::box_2d claw::math::box_2d::intersection( const self_type& r ) const { CLAW_PRECOND( intersects(r) ); self_type result; if ( intersects(r) ) { x_intersection(r, result); y_intersection(r, result); } return result; } // box_2d::intersection() /*----------------------------------------------------------------------------*/ /** * \brief Join two box_2ds. * \param r The box to join with. * \returns a box containing \a *this and \a r. */ template claw::math::box_2d claw::math::box_2d::join( const self_type& r ) const { return self_type ( std::min(r.left(), left()), std::min(r.bottom(), bottom()), std::max(r.right(), right()), std::max(r.top(), top()) ); } // box_2d::join() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the box has a dimension equal to zero. */ template bool claw::math::box_2d::empty() const { return (width() == 0) || (height() == 0); } // box_2d::empty() /*----------------------------------------------------------------------------*/ /** * \brief Get the y-coordinate of the top edge. */ template typename claw::math::box_2d::value_type claw::math::box_2d::top() const { return (first_point.y > second_point.y) ? first_point.y : second_point.y; } // box_2d::top() /*----------------------------------------------------------------------------*/ /** * \brief Get the y-coordinate of the bottom edge. */ template typename claw::math::box_2d::value_type claw::math::box_2d::bottom() const { return (first_point.y < second_point.y) ? first_point.y : second_point.y; } // box_2d::bottom() /*----------------------------------------------------------------------------*/ /** * \brief Get the x-coordinate of the left edge. */ template typename claw::math::box_2d::value_type claw::math::box_2d::left() const { return (first_point.x < second_point.x) ? first_point.x : second_point.x; } // box_2d::left() /*----------------------------------------------------------------------------*/ /** * \brief Get the x-coordinate of the right edge. */ template typename claw::math::box_2d::value_type claw::math::box_2d::right() const { return (first_point.x > second_point.x) ? first_point.x : second_point.x; } // box_2d::right() /*----------------------------------------------------------------------------*/ /** * \brief Get the coordinate of the top-left corner. */ template typename claw::math::box_2d::point_type claw::math::box_2d::top_left() const { return point_type(left(), top()); } // box_2d::top_left() /*----------------------------------------------------------------------------*/ /** * \brief Get the coordinate of the top-right corner. */ template typename claw::math::box_2d::point_type claw::math::box_2d::top_right() const { return point_type(right(), top()); } // box_2d::top_right() /*----------------------------------------------------------------------------*/ /** * \brief Get the coordinate of the bottom-left corner. */ template typename claw::math::box_2d::point_type claw::math::box_2d::bottom_left() const { return point_type(left(), bottom()); } // box_2d::bottom_left() /*----------------------------------------------------------------------------*/ /** * \brief Get the coordinate of the bottom-right corner. */ template typename claw::math::box_2d::point_type claw::math::box_2d::bottom_right() const { return point_type(right(), bottom()); } // box_2d::bottom_right() /*----------------------------------------------------------------------------*/ /** * \brief Move the top edge at a given position. * \param p The position. */ template void claw::math::box_2d::top( const value_type& p ) { shift_y(p - top()); } // box_2d::top() /*----------------------------------------------------------------------------*/ /** * \brief Move the bottom edge at a given position. * \param p The position. */ template void claw::math::box_2d::bottom( const value_type& p ) { shift_y(p - bottom()); } // box_2d::bottom() /*----------------------------------------------------------------------------*/ /** * \brief Move the left edge at a given position. * \param p The position. */ template void claw::math::box_2d::left( const value_type& p ) { shift_x(p - left()); } // box_2d::left() /*----------------------------------------------------------------------------*/ /** * \brief Move the right edge at a given position. * \param p The position. */ template void claw::math::box_2d::right( const value_type& p ) { shift_x(p - right()); } // box_2d::right() /*----------------------------------------------------------------------------*/ /** * \brief Move the top-left corner at a given position. * \param p The position. */ template void claw::math::box_2d::top_left( const coordinate_2d& p ) { top(p.y); left(p.x); } // box_2d::top_left() /*----------------------------------------------------------------------------*/ /** * \brief Move the top-right corner at a given position. * \param p The position. */ template void claw::math::box_2d::top_right( const coordinate_2d& p ) { top(p.y); right(p.x); } // box_2d::top_right() /*----------------------------------------------------------------------------*/ /** * \brief Move the bottom-left corner at a given position. * \param p The position. */ template void claw::math::box_2d::bottom_left( const coordinate_2d& p ) { bottom(p.y); left(p.x); } // box_2d::bottom_left() /*----------------------------------------------------------------------------*/ /** * \brief Move the bottom-right corner at a given position. * \param p The position. */ template void claw::math::box_2d::bottom_right ( const coordinate_2d& p ) { bottom(p.y); right(p.x); } // box_2d::bottom_right() /*----------------------------------------------------------------------------*/ /** * \brief Shift the position of the box on the x-axis. * \param d The movement length. */ template void claw::math::box_2d::shift_x( const value_type& d ) { first_point.x += d; second_point.x += d; } // box_2d::shift_x() /*----------------------------------------------------------------------------*/ /** * \brief Shift the position of the box on the y-axis. * \param d The movement length. */ template void claw::math::box_2d::shift_y( const value_type& d ) { first_point.y += d; second_point.y += d; } // box_2d::shift_y() /*----------------------------------------------------------------------------*/ /** * \brief Get the size of the box_2d. */ template claw::math::coordinate_2d< typename claw::math::box_2d::value_type > claw::math::box_2d::size() const { return claw::math::coordinate_2d(width(), height()); } // box_2d::size() /*----------------------------------------------------------------------------*/ /** * \brief Equality operator * \param that Box to compare to. */ template bool claw::math::box_2d::operator==(const self_type& that) const { return (left() == that.left()) && (right() == that.right()) && (top() == that.top()) && (bottom() == that.bottom()); } // box_2d::operator==() /*----------------------------------------------------------------------------*/ /** * \brief Difference operator. * \param that Box to compare to. */ template bool claw::math::box_2d::operator!=(const self_type& that) const { return !( *this == that ); } // box_2d::operator!=() /*----------------------------------------------------------------------------*/ /** * \brief Translation. * \param vect The vector to add to points. */ template claw::math::box_2d claw::math::box_2d::operator+(const point_type& vect) const { return self_type( first_point + vect, second_point + vect ); } // box_2d::operator+() /*----------------------------------------------------------------------------*/ /** * \brief Translation. * \param vect The vector to substract to points. */ template claw::math::box_2d claw::math::box_2d::operator-(const point_type& vect) const { return self_type( first_point - vect, second_point - vect ); } // box_2d::operator-() /*----------------------------------------------------------------------------*/ /** * \brief Translation. * \param vect The vector to add to points. */ template claw::math::box_2d& claw::math::box_2d::operator+=(const point_type& vect) { first_point += vect; second_point += vect; } // box_2d::operator+=() /*----------------------------------------------------------------------------*/ /** * \brief Translation. * \param vect The vector to substract to points. */ template claw::math::box_2d& claw::math::box_2d::operator-=(const point_type& vect) { first_point -= vect; second_point -= vect; } // box_2d::operator-=() /*----------------------------------------------------------------------------*/ /** * \brief Return box' width. */ template typename claw::math::box_2d::value_type claw::math::box_2d::width() const { if (first_point.x > second_point.x) return first_point.x - second_point.x; else return second_point.x - first_point.x; } // box_2d::width() /*----------------------------------------------------------------------------*/ /** * \brief Return box' height. */ template typename claw::math::box_2d::value_type claw::math::box_2d::height() const { if (first_point.y > second_point.y) return first_point.y - second_point.y; else return second_point.y - first_point.y; } // box_2d::height() /*----------------------------------------------------------------------------*/ /** * \brief X-intersection of two box_2ds. * \pre There is an intersection between this and r. * \post result's x and width fields are filled. */ template void claw::math::box_2d::x_intersection ( const self_type& r, self_type& result ) const { result.first_point.x = std::max(left(), r.left()); result.second_point.x = std::min(right(), r.right()); } // box_2d::x_intersection() /*----------------------------------------------------------------------------*/ /** * \brief Y-intersection of two box_2ds. * \pre There is an intersection between this and r. * \post result's y and height fields are filled. */ template void claw::math::box_2d::y_intersection ( const self_type& r, self_type& result ) const { result.first_point.y = std::max(bottom(), r.bottom()); result.second_point.y = std::min(top(), r.top()); } // box_2d::y_intersection() libclaw-1.7.4/claw/impl/buffered_istream.tpp000066400000000000000000000127041216507631600210750ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file buffered_istream.tpp * \brief Implementation of the claw::buffered_istream class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param f The file associated to the stream. */ template claw::buffered_istream::buffered_istream( stream_type& f ) : m_stream(f), m_begin(NULL), m_end(NULL), m_current(NULL), m_buffer_size(1024) { m_begin = new char[m_buffer_size]; m_end = m_begin; m_current = m_end; } // buffered_istream::buffered_istream() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ template claw::buffered_istream::~buffered_istream() { close(); if (m_begin) delete[] m_begin; } // buffered_istream::~buffered_istream() /*----------------------------------------------------------------------------*/ /** * \brief Tell how many bytes are ready in the buffer. */ template unsigned int claw::buffered_istream::remaining() const { return m_end - m_current; } // buffered_istream::remaining() /*----------------------------------------------------------------------------*/ /** * \brief Increase the number of ready bytes to a given number. * \param n The number of bytes you need. * \remark This method reads n - remaining() bytes from the file. */ template bool claw::buffered_istream::read_more( unsigned int n ) { if ( n <= remaining() ) return true; unsigned int r = remaining(); // we'll reach the end of the buffer if ( m_current + n > m_begin + m_buffer_size ) { // try to avoid reallocation if (n <= m_buffer_size) std::copy(m_current, m_end, m_begin); else // not enough space in the buffer { m_buffer_size = n; char* new_buffer = new char[m_buffer_size]; std::copy(m_current, m_end, new_buffer); delete[] m_begin; m_begin = new_buffer; } m_current = m_begin; m_end = m_current + r; } m_stream.read( m_end, n-r ); m_end += m_stream.gcount(); return !!m_stream; } // buffered_istream::read_more() /*----------------------------------------------------------------------------*/ /** * \brief Get the input buffer. */ template const char* claw::buffered_istream::get_buffer() const { return m_current; } // buffered_istream::get_buffer() /*----------------------------------------------------------------------------*/ /** * \brief Get the next value in the buffer and move one byte forward. */ template char claw::buffered_istream::get_next() { assert( remaining() >= 1 ); char result = *m_current; ++m_current; return result; } // buffered_istream::get_next() /*----------------------------------------------------------------------------*/ /** * \brief Read a range of data. * \param buf The buffer in which we write the read data. * \param n The number of bytes to read. */ template bool claw::buffered_istream::read( char* buf, unsigned int n ) { while ( (n != 0) && !!(*this) ) { if ( n > remaining() ) read_more(m_buffer_size); unsigned int len = std::min(n, remaining()); std::copy( m_current, m_current + len, buf ); buf += len; n -= len; m_current += len; } return n==0; } // buffered_istream::read() /*----------------------------------------------------------------------------*/ /** * \brief Move some bytes forward. * \param n The number of bytes to skip. */ template void claw::buffered_istream::move( unsigned int n ) { assert( m_current + n <= m_end ); m_current += n; } // buffered_istream::move() /*----------------------------------------------------------------------------*/ /** * \brief Closes this buffer (not the stream). * * The cursor of the stream is repositioned according to the remaining data, and * the buffer is cleared. */ template void claw::buffered_istream::close() { m_stream.seekg( m_current - m_end, std::ios_base::cur ); m_current = m_begin; m_end = m_begin; } // buffered_istream::close() /*----------------------------------------------------------------------------*/ /** * \brief Tell if there is still datas in the buffer/stream. */ template claw::buffered_istream::operator bool() const { return m_stream || (remaining() > 0); } // buffered_istream::operator bool() libclaw-1.7.4/claw/impl/buffered_ostream.tpp000066400000000000000000000061531216507631600211040ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file buffered_ostream.tpp * \brief Implementation of the claw::buffered_ostream class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param f The file associated to the stream. * \param buffer_size The size of the buffer. */ template< typename Stream > claw::buffered_ostream::buffered_ostream ( stream_type& f, unsigned int buffer_size ) : m_stream(f), m_begin(new char[buffer_size]), m_end(m_begin+buffer_size), m_current(m_begin) { } // buffered_ostream::buffered_ostream() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ template< typename Stream > claw::buffered_ostream::~buffered_ostream() { flush(); delete[] m_begin; } // buffered_ostream::~buffered_ostream() /*----------------------------------------------------------------------------*/ /** * \brief Write somethnig in the buffer. * \param v The value to write. */ template< typename Stream > template void claw::buffered_ostream::write( T v ) { write( reinterpret_cast(&v), sizeof(v) ); } // buffered_ostream::read_more() /*----------------------------------------------------------------------------*/ /** * \brief Write a range of data in the buffer. * \param p The begining of the range to write. * \param n The length of the buffer pointed by p. */ template< typename Stream > void claw::buffered_ostream::write(const char* p, unsigned int n ) { while (n > 0) { unsigned int q = std::min( n, (unsigned int)(m_end - m_current) ); const char* end = p+q; for ( ; p!=end ; ++p, ++m_current ) *m_current = *p; n -= q; if (m_current == m_end) flush(); } } // buffered_ostream::write() /*----------------------------------------------------------------------------*/ /** * \brief Write the data from the buffer in the stream. */ template< typename Stream > void claw::buffered_ostream::flush() { if (m_current != m_begin) { m_stream.write( m_begin, m_current - m_begin ); m_current = m_begin; } } // buffered_ostream::flush() libclaw-1.7.4/claw/impl/color_palette.tpp000066400000000000000000000057721216507631600204320ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file color_palette.tpp * \brief Implementation of the claw::graphic::color_palette class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param n The size of the palette. */ template< typename Color > claw::graphic::color_palette::color_palette(unsigned int n) : m_palette(n) { } // color_palette::color_palette() /*----------------------------------------------------------------------------*/ /** * \brief Get the number of colors in the palette. */ template< typename Color > unsigned int claw::graphic::color_palette::size() const { return m_palette.size(); } // color_palette::size() /*----------------------------------------------------------------------------*/ /** * \brief Get a color from the palette. * \param i The index of the color. * \pre \a i is a valid color index. */ template< typename Color > typename claw::graphic::color_palette::color_type& claw::graphic::color_palette::operator[]( unsigned int i ) { assert( i < m_palette.size() ); return m_palette[i]; } // color_palette::operator[]() /*----------------------------------------------------------------------------*/ /** * \brief Get the value of a color from the palette. * \param i The index of the color. * \pre \a i is a valid color index. */ template< typename Color > const typename claw::graphic::color_palette::color_type& claw::graphic::color_palette::operator[]( unsigned int i ) const { assert( i < m_palette.size() ); return m_palette[i]; } // color_palette::operator[]() [const] /*----------------------------------------------------------------------------*/ /** * \brief Get the value of a color from the palette. * \param i The index of the color. * \pre \a i is a valid color index. */ template< typename Color > const typename claw::graphic::color_palette::color_type& claw::graphic::color_palette::operator()( unsigned int i ) const { assert( i < m_palette.size() ); return m_palette[i]; } // color_palette::operator()() libclaw-1.7.4/claw/impl/coordinate_2d.tpp000066400000000000000000000211131216507631600202750ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file coordinate_2d.tpp * \brief Implementation of claw::math::coordinate_2d class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ template claw::math::coordinate_2d::coordinate_2d() { } // coordinate_2d::coordinate_2d() [constructor] /*----------------------------------------------------------------------------*/ /** * \brief Copy constructor. */ template template claw::math::coordinate_2d::coordinate_2d(const coordinate_2d& that) : x(that.x), y(that.y) { } // coordinate_2d::coordinate_2d() [copy constructor] /*----------------------------------------------------------------------------*/ /** * \brief Constructor with initialization. * \param _x x value. * \param _y y Value. */ template claw::math::coordinate_2d::coordinate_2d (const value_type& _x, const value_type& _y) : x(_x), y(_y) { } // coordinate_2d::coordinate_2d() [constructor whit values] /*----------------------------------------------------------------------------*/ /** * \brief Get a copy of the rectangle by converting its members to a given type. * * Consider the following code: * * coordinate_2d a; * * ... * * coordinate_2d b(a); * * The copy constructor will be called, and your compiler should print some * warnings in your console. These warnings have a meaning, so we don't wan't to * make them disapear by adding explicit type conversion inside the * coordinate_2d class nor adding a cast operator that will be used silently by * the compiler. * * If you really want to convert the type, this method will explicitly cast the * member variables. */ template template claw::math::coordinate_2d claw::math::coordinate_2d::cast_value_type_to() const { return claw::math::coordinate_2d( (U)x, (U)y ); } // coordinate_2d::cast_value_type_to() /*----------------------------------------------------------------------------*/ /** * \brief Sets new values to the coordinate. * \param _x New x value. * \param _y New y Value. */ template void claw::math::coordinate_2d::set(const value_type& _x, const value_type& _y) { x = _x; y = _y; } // coordinate_2d::set() /*----------------------------------------------------------------------------*/ /** * \brief Get the distance separing two coordinates. * \param p The second coordinate */ template typename claw::math::coordinate_2d::value_type claw::math::coordinate_2d::distance(const self_type& p) const { return (value_type)sqrt( (p.x - x)*(p.x - x) + (p.y - y)*(p.y - y) ); } // coordinate_2d::distance() /*----------------------------------------------------------------------------*/ /** * \brief Rotate this point around an other point. * \param center The other point. * \param angle The angle of the rotation. */ template void claw::math::coordinate_2d::rotate( const self_type& center, double angle ) { self_type result(center); result.x += (x - center.x) * std::cos(angle) - (y - center.y) * std::sin(angle); result.y += (x - center.x) * std::sin(angle) + (y - center.y) * std::cos(angle); *this = result; } // coordinate_2d::rotate() /*----------------------------------------------------------------------------*/ /** * \brief Get the angle of the slope starting from this and ending with an other * coordinate. * \param to The other point. */ template double claw::math::coordinate_2d::slope_angle( const self_type& to ) const { return std::atan2( to.y - y, to.x - x ); } // coordinate_2d::slope_angle() /*----------------------------------------------------------------------------*/ /** * \brief Equality operator. * \param that Coordinate to compare to. */ template bool claw::math::coordinate_2d::operator==(const self_type& that) const { return (x == that.x) && (y == that.y); } // coordinate_2d::operator==() /*----------------------------------------------------------------------------*/ /** * \brief Difference operator. * \param that Coordinate to compare to. */ template bool claw::math::coordinate_2d::operator!=(const self_type& that) const { return !(*this == that); } // coordinate_2d::operator!=() /*----------------------------------------------------------------------------*/ /** * \brief Addition. * \param that Coordinate to add. */ template claw::math::coordinate_2d claw::math::coordinate_2d::operator+(const self_type& that) const { return self_type( x + that.x, y + that.y ); } // coordinate_2d::operator+() /*----------------------------------------------------------------------------*/ /** * \brief Subtraction. * \param that Coordinate to subtract. */ template claw::math::coordinate_2d claw::math::coordinate_2d::operator-(const self_type& that) const { return self_type( x - that.x, y - that.y ); } // coordinate_2d::operator-() /*----------------------------------------------------------------------------*/ /** * \brief Add a coordinate. * \param that Coordinate to add. */ template claw::math::coordinate_2d& claw::math::coordinate_2d::operator+=(const self_type& that) { x += that.x; y += that.y; return *this; } // coordinate_2d::operator+=() /*----------------------------------------------------------------------------*/ /** * \brief Subtract a coordinate. * \param that Coordinate to subtract. */ template claw::math::coordinate_2d& claw::math::coordinate_2d::operator-=(const self_type& that) { x -= that.x; y -= that.y; return *this; } // coordinate_2d::operator-=() /*----------------------------------------------------------------------------*/ /** * \brief Multiplication. * \param v Factor. */ template claw::math::coordinate_2d claw::math::coordinate_2d::operator*(const value_type& v) const { return self_type( x * v, y * v ); } // coordinate_2d::operator*() /*----------------------------------------------------------------------------*/ /** * \brief Division. * \param v Divider. */ template claw::math::coordinate_2d claw::math::coordinate_2d::operator/(const value_type& v) const { return self_type( x / v, y / v ); } // coordinate_2d::operator/() /*----------------------------------------------------------------------------*/ /** * \brief Multiply the coordinates. * \param v Factor. */ template claw::math::coordinate_2d& claw::math::coordinate_2d::operator*=(const value_type& v) { x *= v; y *= v; return *this; } // coordinate_2d::operator*=() /*----------------------------------------------------------------------------*/ /** * \brief Divide the coordinates. * \param v Divider. */ template claw::math::coordinate_2d& claw::math::coordinate_2d::operator/=(const value_type& v) { x /= v; y /= v; return *this; } // coordinate_2d::operator/=() /*----------------------------------------------------------------------------*/ /** * \brief Unary minus. * \param that The operand... */ template claw::math::coordinate_2d claw::math::operator-( const claw::math::coordinate_2d& that ) { return claw::math::coordinate_2d(-that.x, -that.y); } // operator-() [coordinate_2d] /*----------------------------------------------------------------------------*/ /** * \brief Multiply coordinates. * \param v The multiplicator. * \param self The coordinates to multiply. */ template claw::math::coordinate_2d claw::math::operator*( U v, const coordinate_2d& self ) { return self * typename coordinate_2d::value_type(v); } // operator*() [coordinate_2d] libclaw-1.7.4/claw/impl/curve.tpp000066400000000000000000000612061216507631600167140ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/impl/curve.tpp * \brief Implementation of claw::math::curve. * \author Julien Jorge */ #include #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ template claw::math::curve::control_point::control_point() { } // curve::control_point::control_point() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param p The position of this control point. It will be assigned to the input * and output directions too. */ template claw::math::curve::control_point::control_point ( const coordinate_type& p ) : m_position(p), m_input_direction(p), m_output_direction(p) { } // curve::control_point::control_point() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param p The position of this control point. * \param input_direction The point in the direction of which the curve enters * \a p. * \param output_direction The point in the direction of which the curve leaves * \a p. */ template claw::math::curve::control_point::control_point ( const coordinate_type& p, const coordinate_type& input_direction, const coordinate_type& output_direction ) : m_position(p), m_input_direction(input_direction), m_output_direction(output_direction) { } // curve::control_point::control_point() /*----------------------------------------------------------------------------*/ /** * \brief Get the position of this control point. */ template const typename claw::math::curve::control_point::coordinate_type& claw::math::curve::control_point::get_position() const { return m_position; } // curve::control_point::get_position() /*----------------------------------------------------------------------------*/ /** * \brief Get the point in the direction of which the curve enters this * position. */ template const typename claw::math::curve::control_point::coordinate_type& claw::math::curve::control_point::get_input_direction() const { return m_input_direction; } // curve::control_point::get_input_direction() /*----------------------------------------------------------------------------*/ /** * \brief Get the point in the direction of which the curve leaves this * position. */ template const typename claw::math::curve::control_point::coordinate_type& claw::math::curve::control_point::get_output_direction() const { return m_output_direction; } // curve::control_point::get_output_direction() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param position The position of the point. * \param s The section on which the point has been found. * \param t The date of the point on the section. */ template claw::math::curve::section::resolved_point::resolved_point ( const coordinate_type& position, const section& s, const double t ) : m_position(position), m_section(s), m_date(t) { } // curve::section::resolved_point::resolved_point() /*----------------------------------------------------------------------------*/ /** * \brief Get The position of the point. */ template const typename claw::math::curve::section::resolved_point::coordinate_type& claw::math::curve::section::resolved_point::get_position() const { return m_position; } // curve::section::resolved_point::get_position() /*----------------------------------------------------------------------------*/ /** * \brief Get the section on which the point has been found. */ template const typename claw::math::curve::section& claw::math::curve::section::resolved_point::get_section() const { return m_section; } // curve::section::::resolved_point::get_section() /*----------------------------------------------------------------------------*/ /** * \brief Get the date of the point on the section. */ template double claw::math::curve::section::resolved_point::get_date() const { return m_date; } // curve::section::resolved_point::get_date() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param origin The point at the beginning of the section. * \param end The point at the end of the section. */ template claw::math::curve::section::section ( const iterator_type& origin, const iterator_type& end ) : m_origin(origin), m_end(end) { } // curve::section::section() /*----------------------------------------------------------------------------*/ /** * \brief Get the point of this section at a given date. * \param t The date at which the point is computed. */ template typename claw::math::curve::section::coordinate_type claw::math::curve::section::get_point_at( double t ) const { if ( m_origin == m_end ) return m_origin->get_position(); const value_type x ( evaluate ( t, traits_type::get_x(m_origin->get_position()), traits_type::get_x(m_origin->get_output_direction()), traits_type::get_x(m_end->get_input_direction()), traits_type::get_x(m_end->get_position()) ) ); const value_type y ( evaluate ( t, traits_type::get_y(m_origin->get_position()), traits_type::get_y(m_origin->get_output_direction()), traits_type::get_y(m_end->get_input_direction()), traits_type::get_y(m_end->get_position()) ) ); return traits_type::make_coordinate( x, y ); } // curve::section::get_point_at() /*----------------------------------------------------------------------------*/ /** * \brief Get the direction of the tangent at a given date. * \param t The date for which we want the tangent. */ template typename claw::math::curve::section::coordinate_type claw::math::curve::section::get_tangent_at( double t ) const { const value_type dx = evaluate_derived ( t, traits_type::get_x(m_origin->get_position()), traits_type::get_x(m_origin->get_output_direction()), traits_type::get_x(m_end->get_input_direction()), traits_type::get_x(m_end->get_position()) ); const value_type dy = evaluate_derived ( t, traits_type::get_y(m_origin->get_position()), traits_type::get_y(m_origin->get_output_direction()), traits_type::get_y(m_end->get_input_direction()), traits_type::get_y(m_end->get_position()) ); if ( dx == 0 ) return traits_type::make_coordinate( 0, (dy < 0) ? -1 : 1 ); else return traits_type::make_coordinate( 1, dy / dx ); } // curve::section::get_tangent_at() /*----------------------------------------------------------------------------*/ /** * \brief Get the points having the given x-coordinate on this section. * \param x The coordinate for which we want the points. * \param off_domain Tell the method to keep the points found at a date outside * [0, 1]. */ template std::vector::section::resolved_point> claw::math::curve::section::get_point_at_x ( value_type x, bool off_domain ) const { std::vector result; if ( empty() ) return result; const std::vector roots ( get_roots ( x, traits_type::get_x(m_origin->get_position()), traits_type::get_x(m_origin->get_output_direction()), traits_type::get_x(m_end->get_input_direction()), traits_type::get_x(m_end->get_position() ) ) ); for ( std::size_t i=0; i!=roots.size(); ++i ) result.push_back ( resolved_point( get_point_at( roots[i] ), *this, roots[i] ) ); ensure_ends_in_points ( result, (x == m_origin->get_position().x), (x == m_end->get_position().x) ); if ( !off_domain ) return extract_domain_points( result ); else return result; } // curve::section::get_point_at_x() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the control point at the origin of the section in * the curve from which it was created. */ template const typename claw::math::curve::section::iterator_type& claw::math::curve::section::get_origin() const { return m_origin; } // curve::section::get_origin() /*----------------------------------------------------------------------------*/ /** * \brief Tell if there is no points on this section. */ template bool claw::math::curve::section::empty() const { return m_origin == m_end; } // curve::section::empty() /*----------------------------------------------------------------------------*/ /** * \brief Get the value of the curve's equation on one dimension, at a given * date. * \param t The date at which the value us computed. * \param origin The value on the computed dimension of the first point of the * section of the curve. * \param output_direction The value on the computed dimension of the point in * the direction of which the curve leaves \a origin. * \param input_direction The value on the computed dimension of the point in * the direction of which the curve enters \a end. * \param origin The value on the computed dimension of the last point of the * section of the curve. */ template typename claw::math::curve::section::value_type claw::math::curve::section::evaluate ( double t, value_type origin, value_type output_direction, value_type input_direction, value_type end ) const { const double dt(1 - t); return origin * dt * dt * dt + 3 * output_direction * t * dt * dt + 3 * input_direction * t * t * dt + end * t * t * t; } // curve::section::evaluate() /*----------------------------------------------------------------------------*/ /** * \brief Get the value at a given date of the curve's derived equation on one * dimension. * \param t The date at which the value us computed. * \param origin The value on the computed dimension of the first point of the * section of the curve. * \param output_direction The value on the computed dimension of the point in * the direction of which the curve leaves \a origin. * \param input_direction The value on the computed dimension of the point in * the direction of which the curve enters \a end. * \param origin The value on the computed dimension of the last point of the * section of the curve. */ template typename claw::math::curve::section::value_type claw::math::curve::section::evaluate_derived ( double t, value_type origin, value_type output_direction, value_type input_direction, value_type end ) const { return - 3 * origin + 3 * output_direction + (6 * origin - 12 * output_direction + 6 * input_direction) * t + (-3 * origin + 9 * output_direction - 9 * input_direction + 3 * end) * t * t; } // curve::section::evaluate_derived() /*----------------------------------------------------------------------------*/ /** * \brief Ensure that a vector of resolved_point contains some ends of the * curve. * * The computation on the doubles values may produce approximated resolved * points. If one end of the curve is expected to be in the resolved point, then * this procedure replaces the nearest resolved point by a resolved point on * the adequate end. * * \param p The points to filter. * \param ensure_origin Tell to guarantee that the origin is present in \a p. * \param ensure_end Tell to guarantee that the end is present in \a p. */ template void claw::math::curve::section::ensure_ends_in_points ( std::vector& p, bool ensure_origin, bool ensure_end ) const { double min_distance_origin( std::numeric_limits::max() ); double min_distance_end( std::numeric_limits::max() ); std::size_t origin_index(p.size()); std::size_t end_index(p.size()); for ( std::size_t i=0; i!=p.size(); ++i ) { const double distance_origin( std::abs( p[i].get_date() ) ); if ( distance_origin <= min_distance_origin ) { min_distance_origin = distance_origin; origin_index = i; } const double distance_end( std::abs( 1 - p[i].get_date() ) ); if ( distance_end <= min_distance_end ) { min_distance_end = distance_end; end_index = i; } } if ( ensure_origin ) p[origin_index] = resolved_point( m_origin->get_position(), *this, 0.0 ); if ( ensure_end ) p[end_index] = resolved_point( m_end->get_position(), *this, 1.0 ); } // curve::section::ensure_ends_in_points() /*----------------------------------------------------------------------------*/ /** * \brief Extract the points in the domain of the curve. * \param p The points from which we extract the ones whose date is in [0, 1]. */ template std::vector::section::resolved_point> claw::math::curve::section::extract_domain_points ( const std::vector& p ) const { std::vector clean_result; for ( std::size_t i=0; i!=p.size(); ++i ) if ( (p[i].get_date() >= 0) && (p[i].get_date() <= 1) ) clean_result.push_back( p[i] ); return clean_result; } // curve::section::extract_domain_points() /*----------------------------------------------------------------------------*/ /** * \brief Get the dates at which the curve passes at a given coordinate, on a given dimension. * \param x The coordinate for which we want the dates. * \param origin The value on the computed dimension of the first point of the * section of the curve. * \param output_direction The value on the computed dimension of the point in * the direction of which the curve leaves \a origin. * \param input_direction The value on the computed dimension of the point in * the direction of which the curve enters \a end. * \param end The value on the computed dimension of the last point of the * section of the curve. */ template std::vector claw::math::curve::section::get_roots ( value_type x, value_type origin, value_type output_direction, value_type input_direction, value_type end ) const { const value_type a (-origin + 3 * output_direction - 3 * input_direction + end ); const value_type b( 3 * origin - 6 * output_direction + 3 * input_direction ); const value_type c( -3 * origin + 3 * output_direction ); const value_type d( origin - x ); if ( a == 0 ) return get_roots_degree_2(b, c, d); else return get_roots_degree_3(a, b, c, d); } // curve::section::get_roots() /*----------------------------------------------------------------------------*/ /** * \brief Get the dates at which the curve passes at a given coordinate, in the * case where the equation is a reduced to a polynom of degree 2. * \param a The coefficient of the square part of the equation. * \param b The coefficient of the linear part of the equation. * \param c The constant of the equation. */ template std::vector claw::math::curve::section::get_roots_degree_2 ( value_type a, value_type b, value_type c ) const { const value_type delta( b * b - 4 * a * c ); std::vector result; if ( delta == 0 ) result.push_back( - b / ( 2 * a ) ); else if ( delta > 0 ) { result.push_back( (-b - std::sqrt(delta)) / (2 * a) ); result.push_back( (-b + std::sqrt(delta)) / (2 * a) ); } return result; } // curve::section::get_roots_degree_2() /*----------------------------------------------------------------------------*/ /** * \brief Get the dates at which the curve passes at a given coordinate, in the * case where the equation is a reduced to a polynom of degree 3. * \param a The coefficient of the cubic part of the equation. * \param b The coefficient of the square part of the equation. * \param c The coefficient of the linear part of the equation. * \param d The constant of the equation. */ template std::vector claw::math::curve::section::get_roots_degree_3 ( value_type a, value_type b, value_type c, value_type d ) const { // The following is the application of the method of Cardan const value_type p( -(b * b) / (3.0 * a * a) + c / a ); const value_type q ( ( b / (27.0 * a) ) * ( (2.0 * b * b) / (a * a) - 9.0 * c / a ) + d / a ); const value_type delta( q * q + 4.0 * p * p * p / 27.0 ); std::vector result; if ( delta == 0 ) { if ( p == 0 ) result.push_back(0); else { result.push_back( 3.0 * q / p - b / (3.0 * a) ); result.push_back( - 3.0 * q / (2.0 * p) - b / (3.0 * a) ); } } else if ( delta > 0 ) { result.push_back ( boost::math::cbrt ( (-q + std::sqrt(delta)) / 2.0 ) + boost::math::cbrt ( (-q - std::sqrt(delta)) / 2.0 ) - b / (3.0 * a)); } else for ( std::size_t i=0; i!=3; ++i ) result.push_back ( 2.0 * std::sqrt( -p / 3.0 ) * std::cos ( std::acos( std::sqrt(27.0 / (- p * p * p)) * - q / 2.0 ) / 3.0 + 2.0 * i * boost::math::constants::pi() / 3.0 ) - b / (3.0 * a)); return result; } // curve::section::get_roots_degree_3() /*----------------------------------------------------------------------------*/ /** * \brief Add a point at the end of the curve. * \param p The point to add. */ template void claw::math::curve::push_back( const control_point& p ) { m_points.push_back(p); } // curve::push_back() /*----------------------------------------------------------------------------*/ /** * \brief Add a point at the beginning of the curve. * \param p The point to add. */ template void claw::math::curve::push_front( const control_point& p ) { m_points.push_front(p); } // curve::push_front() /*----------------------------------------------------------------------------*/ /** * \brief Add a point before an other point of the curve. * \param pos An iterator on the point before which the control point is added. * \param p The point to add. */ template void claw::math::curve::insert ( const iterator& pos, const control_point& p ) { m_points.insert( pos, p ); } // curve::insert() /*----------------------------------------------------------------------------*/ /** * \brief Get the section of the curve starting at a given control point. * \param pos An iterator of the control point at which the returned section * begins. */ template typename claw::math::curve::section claw::math::curve::get_section( const const_iterator& pos ) const { const_iterator it(pos); ++it; if ( it == end() ) return section( pos, pos ); else return section( pos, it ); } // curve::get_section() /*----------------------------------------------------------------------------*/ /** * \brief Get the points having the given x-coordinate on the curve. * \param x The coordinate for which we want the points. * \param off_domain Tell the method to keep the points found at a date outside * [0, 1]. * * \todo Remove the duplicates in the result. */ template std::vector< typename claw::math::curve::section::resolved_point > claw::math::curve::get_point_at_x ( value_type x, bool off_domain ) const { typedef std::vector result_type; result_type result; for ( const_iterator it=begin(); it!=end(); ++it ) { const section s( get_section(it) ); if ( !s.empty() ) { const result_type new_points( s.get_point_at_x(x) ); result.insert( result.end(), new_points.begin(), new_points.end() ); } } if ( off_domain ) { const result_type before( get_point_at_x_before_origin(x) ); result.insert( result.begin(), before.begin(), before.end() ); const result_type after( get_point_at_x_after_end(x) ); result.insert( result.end(), after.begin(), after.end() ); } return result; } // curve::get_point_at_x() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the first control point. */ template typename claw::math::curve::iterator claw::math::curve::begin() { return m_points.begin(); } // curve::begin() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator past the last control point. */ template typename claw::math::curve::iterator claw::math::curve::end() { return m_points.end(); } // curve::end() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the first control point. */ template typename claw::math::curve::const_iterator claw::math::curve::begin() const { return m_points.begin(); } // curve::begin() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator past the last control point. */ template typename claw::math::curve::const_iterator claw::math::curve::end() const { return m_points.end(); } // curve::end() /*----------------------------------------------------------------------------*/ /** * \brief Get the points having the given x-coordinate before the origin of the * curve. * \param x The coordinate for which we want the points. */ template std::vector< typename claw::math::curve::section::resolved_point > claw::math::curve::get_point_at_x_before_origin( value_type x ) const { typedef std::vector result_type; result_type result; const section s( get_section(begin()) ); if ( !s.empty() ) { const result_type points( s.get_point_at_x(x, true) ); for ( std::size_t i(0); i!=points.size(); ++i ) if ( points[i].get_date() < 0 ) result.push_back( points[i] ); } return result; } // curve::get_point_at_x_before_origin() /*----------------------------------------------------------------------------*/ /** * \brief Get the points having the given x-coordinate after the end of the * curve. * \param x The coordinate for which we want the points. */ template std::vector< typename claw::math::curve::section::resolved_point > claw::math::curve::get_point_at_x_after_end( value_type x ) const { typedef std::vector result_type; result_type result; if ( m_points.size() < 2 ) return result; const_iterator it(end()); std::advance(it, -2); const section s( get_section( it ) ); if ( !s.empty() ) { const result_type points( s.get_point_at_x(x, true) ); for ( std::size_t i(0); i!=points.size(); ++i ) if ( points[i].get_date() > 1 ) result.push_back( points[i] ); } return result; } // curve::get_point_at_x_after_end() libclaw-1.7.4/claw/impl/dynamic_library.tpp000066400000000000000000000026541216507631600207420ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file dynamic_library.tpp * \brief Implementation of the template methods of the claw::dynamic_library * class. * \author Julien Jorge */ /*----------------------------------------------------------------------------*/ /** * \brief Get a symbol in the library. * \param name The name of the symbol to get. */ template T claw::dynamic_library::get_symbol( const std::string& name ) const { return dynamic_library_traits::get_symbol(m_handle, name); } // dynamic_library::get_symbol() libclaw-1.7.4/claw/impl/factory.tpp000066400000000000000000000075271216507631600172450ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file factory.tpp * \brief Implementation of the claw::pattern::factory class. * \author Julien Jorge */ /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ template claw::pattern::factory ::class_creator_base::~class_creator_base() { } // factory::class_creator_base::~class_creator_base() /*----------------------------------------------------------------------------*/ /** * \brief Create an instance of the derived type.. */ template template Derived* claw::pattern::factory ::class_creator::create() const { return new Derived; } // factory::class_creator::create() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ template claw::pattern::factory::~factory() { typename class_map::const_iterator it; for (it=m_classes.begin(); it!=m_classes.end(); ++it) delete it->second; m_classes.clear(); } // factory::~factory() /*----------------------------------------------------------------------------*/ /** * \brief Register a type in the factory. * \param id The identifier to which the type is associated. * \return true if successful. * * \b Template \b parameters: * - \a T The type to register. */ template template bool claw::pattern::factory::register_type ( const identifier_type& id ) { typename class_map::iterator it = m_classes.find(id); if ( it == m_classes.end() ) { m_classes[id] = new class_creator; return true; } else return false; } // factory::register_type() /*----------------------------------------------------------------------------*/ /** * \brief Create a new instance. * \param id The identifier of the type to instanciate. * \return A pointer to the newly created instance. */ template typename claw::pattern::factory::base_class* claw::pattern::factory::create ( const identifier_type& id ) const { typename class_map::const_iterator it = m_classes.find(id); if ( it==m_classes.end() ) throw bad_type_identifier(); else return it->second->create(); } // factory::create() /*----------------------------------------------------------------------------*/ /** * \brief Tell in a type with a given id is known by the factory. * \param id The identifier of the type to check. */ template bool claw::pattern::factory::is_known_type ( const identifier_type& id ) const { return m_classes.find(id) != m_classes.end(); } // factory::is_known_type() libclaw-1.7.4/claw/impl/game_ai.tpp000066400000000000000000000277141216507631600171600ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005 SĂŠbastien Angibaud Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file game_ai.tpp * \brief ImplĂŠmentation de fonctions d'intelligence artificielle. * \author Julien Jorge & SĂŠbastien Angibaud */ #include #include //**************************** gamestate ************************************** /*---------------------------------------------------------------------------*/ /** * \brief Destructor. */ template claw::ai::game::game_state::~game_state() { // nothing to do } // game_state::~game_state() /*---------------------------------------------------------------------------*/ /** * \brief Get the minimal score a state can get. */ template typename claw::ai::game::game_state::score claw::ai::game::game_state::min_score() { return s_min_score; } // game_state::min_score() /*---------------------------------------------------------------------------*/ /** * \brief Get the maximal score a state can get. */ template typename claw::ai::game::game_state::score claw::ai::game::game_state::max_score() { return s_max_score; } // game_state::max_score() /*---------------------------------------------------------------------------*/ /** * \brief Truncate a score to fit in the range (min_score(), max_score()). * \param score_val The value to fit. */ template typename claw::ai::game::game_state::score claw::ai::game::game_state::fit ( score score_val ) const { if ( s_max_score < score_val ) return s_max_score; else if ( score_val < s_min_score ) return s_min_score; else return score_val; } // game_state::fit() //**************************** action_eval ************************************ /*---------------------------------------------------------------------------*/ /** * \brief Constructor. * \param a The evaluated action. * \param e The evaluation of the action. */ template claw::ai::game::action_eval::action_eval ( const Action& a, const Numeric& e) : action(a), eval(e) { } // action_eval::action_eval() /*---------------------------------------------------------------------------*/ /** * \brief Compare with an otreh action. * \param ae The other action. */ template bool claw::ai::game::action_eval::operator< ( const action_eval& ae ) const { return eval < ae.eval; } // action_eval::operator<() #if 0 /*---------------------------------------------------------------------------*/ /** * \brief EgalitĂŠ de deux actions. * \return vrai si this->eval == ae.eval. */ template bool claw::ai::game::action_eval::operator== ( const action_eval& ae ) const { return eval == ae.eval; } // action_eval::operator==() #endif //********************************* min_max *********************************** /*---------------------------------------------------------------------------*/ /** * \brief Apply the min-max algorithm to find the best action. * \param depth Depth of the search subtree we are allowed to explore. * \param current_state The state of the game. * \param computer_turn Tell if the next action is done by the computer. */ template typename claw::ai::game::min_max::score claw::ai::game::min_max::operator() ( int depth, const state& current_state, bool computer_turn ) const { score score_val; // we reached a final state or we are not allowed to search more. if ( current_state.final() || (depth == 0) ) score_val = current_state.evaluate(); else { std::list next_actions; typename std::list::const_iterator it; state* new_state; // get all reachable states current_state.next_actions( next_actions ); if ( next_actions.empty() ) score_val = current_state.evaluate(); else if (computer_turn) { score_val = current_state.min_score(); for (it = next_actions.begin(); it!=next_actions.end(); ++it) { new_state=static_cast(current_state.do_action(*it)); // evaluate the action of the human player score s = (*this)( depth-1, *new_state, false ); // and keep the best action he can do. if (s > score_val) score_val = s; delete new_state; } } else // human player's turn { score_val = current_state.max_score(); for (it = next_actions.begin(); it!=next_actions.end(); ++it) { new_state=static_cast(current_state.do_action(*it)); // evaluate the action of the computer player score s = (*this)( depth-1, *new_state, true ); // and keep the worst action he can do if (s < score_val) score_val = s; delete new_state; } } } return score_val; } // min_max::operator() //******************************** alpha_beta ********************************* /*---------------------------------------------------------------------------*/ /** * \brief Apply the alpha-beta algorithm to find the best action. * \param depth Depth of the search subtree we are allowed to explore. * \param current_state The state of the game. * \param computer_turn Tell if the next action is done by the computer. */ template typename State::score claw::ai::game::alpha_beta::operator() ( int depth, const state& current_state, bool computer_turn ) const { return this->compute ( depth, current_state, computer_turn, current_state.min_score(), current_state.max_score() ); } // alpha_beta::operator() /*---------------------------------------------------------------------------*/ /** * \brief Find the best action using an alpha-beta algorithm. * \param depth Depth of the search subtree we are allowed to explore. * \param current_state The state of the game. * \param computer_turn Tell if the next action is done by the computer. * \param alpha Worst score of the current player. * \param beta Best score of the other player. */ template typename claw::ai::game::alpha_beta::score claw::ai::game::alpha_beta::compute ( int depth, const state& current_state, bool computer_turn, score alpha, score beta ) const { score score_val; // we reached a final state or we are not allowed to search more. if ( current_state.final() || (depth == 0) ) score_val = current_state.evaluate(); else { std::list next_actions; typename std::list::const_iterator it; State* new_state; // get all reachable states current_state.next_actions( next_actions ); if ( next_actions.empty() ) score_val = current_state.evaluate(); else if (computer_turn) { score_val = current_state.min_score(); it = next_actions.begin(); while ( it!=next_actions.end() && (score_val < beta) ) { new_state=static_cast(current_state.do_action(*it)); // evaluate the action of the human player score s = compute ( depth-1, *new_state, false, std::max(alpha, score_val), beta ); // and keep the best action he can do. if (s > score_val) score_val = s; delete new_state; ++it; } } else // human player's turn { score_val = current_state.max_score(); it = next_actions.begin(); while ( it!=next_actions.end() && (score_val > alpha) ) { new_state=static_cast(current_state.do_action(*it)); // evaluate the action of the computer player score s = compute ( depth-1, *new_state, true, alpha, std::min(beta, score_val) ); // and keep the worst action he can do if (s < score_val) score_val = s; ++it; delete new_state; } } } return score_val; } // alpha_beta::compute() //***************************** select_action ********************************* /*---------------------------------------------------------------------------*/ /** * \brief Select an action using the given method. * \param depth Maximum depth of the search tree. * \param current_state The state of the game. * \param new_action (in/out) Best known action. * \param computer_turn Tell if the action is done by the computer. */ template void claw::ai::game::select_action::operator() ( int depth, const state& current_state, action& new_action, bool computer_turn ) const { std::list l; typename std::list::iterator it; score best_eval; Method method; // get all reachable states current_state.next_actions( l ); best_eval = current_state.min_score(); for (it=l.begin(); it!=l.end(); ++it) { state* new_state; score eval; // try and evaluate each action new_state = static_cast(current_state.do_action(*it)); eval = method(depth-1, *new_state, !computer_turn); delete new_state; // we keep one of the best actions if (eval > best_eval) { best_eval = eval; new_action = *it; } } } // select_action::operator() //*************************** select_random_action **************************** /** * \brief Select a random action among the best ones. * \param depth Maximum depth of the search tree. * \param current_state The state of the game. * \param new_action (in/out) Best known action. * \param computer_turn Tell if the action is done by the computer. */ template void claw::ai::game::select_random_action::operator() ( int depth, const state& current_state, action& new_action, bool computer_turn ) const { std::list l; typename std::list::iterator it; action_eval eval( new_action, current_state.min_score() ); Method method; max_vector< action_eval > events( eval ); // get all reachable states current_state.next_actions( l ); for (it=l.begin(); it!=l.end(); ++it) { state* new_state; // try and evaluate each action new_state = static_cast(current_state.do_action(*it)); eval.action = *it; eval.eval = method(depth-1, *new_state, !computer_turn); delete new_state; // keep the best actions. events.add( eval ); } std::size_t i = (double)rand()/(RAND_MAX + 1) * events.get_v().size(); new_action = events.get_v()[i].action; } // select_random_action::operator() libclaw-1.7.4/claw/impl/glob.tpp000066400000000000000000000106351216507631600165130ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file string_algorithm.tpp * \brief Implementation of the globalization algorithms. * \author Julien Jorge */ /*----------------------------------------------------------------------------*/ /** * \brief Check if a sequence matches a given pattern. * \param pattern_first Iterator on the beginning of the pattern. * \param pattern_last Iterator just past the end of the pattern. * \param first Iterator on the beginning of the sequence. * \param last Iterator just last the end of the sequence. * \param any_sequence A value representing any sequence of values, empty or * not. * \param zero_or_one A value representing any value or no value. * \param any A value representing any value. */ template bool claw::glob_match ( InputIterator1 pattern_first, InputIterator1 pattern_last, InputIterator2 first, InputIterator2 last, typename InputIterator1::value_type any_sequence, typename InputIterator1::value_type zero_or_one, typename InputIterator1::value_type any ) { bool result(false); if ( (pattern_first == pattern_last) || (first == last) ) { result = (first == last); for ( ; result && (pattern_first != pattern_last); ++ pattern_first ) result = (*pattern_first == any_sequence) || (*pattern_first == zero_or_one); } else if ( *pattern_first == any_sequence ) result = glob_match ( pattern_first + 1, pattern_last, first, last, any_sequence, zero_or_one, any) || glob_match ( pattern_first, pattern_last, first + 1, last, any_sequence, zero_or_one, any ); else if ( *pattern_first == zero_or_one ) result = glob_match ( pattern_first + 1, pattern_last, first, last, any_sequence, zero_or_one, any) || glob_match ( pattern_first + 1, pattern_last, first + 1, last, any_sequence, zero_or_one, any ); else if ( (*pattern_first == zero_or_one) || (*pattern_first == *first) ) result = glob_match ( pattern_first + 1, pattern_last, first + 1, last, any_sequence, zero_or_one, any ); else result = false; return result; } // glob_match() /*----------------------------------------------------------------------------*/ /** * \brief Check if a sequence may match a given pattern. * \param pattern_first Iterator on the beginning of the pattern. * \param pattern_last Iterator just past the end of the pattern. * \param first Iterator on the beginning of the sequence. * \param last Iterator just last the end of the sequence. * \param any_sequence A value representing any sequence of values, empty or * not. * \param zero_or_one A value representing any value or no value. * \param any A value representing any value. */ template bool claw::glob_potential_match ( InputIterator1 pattern_first, InputIterator1 pattern_last, InputIterator2 first, InputIterator2 last, typename InputIterator1::value_type any_sequence, typename InputIterator1::value_type zero_or_one, typename InputIterator1::value_type any ) { bool result(true); bool stop(false); while ( !stop && (pattern_first != pattern_last) && (first != last) ) if ( (*pattern_first == any_sequence) || (*pattern_first == zero_or_one) ) stop = true; else if ( *pattern_first == any ) { ++pattern_first; ++first; } else if ( *pattern_first == *first ) { ++pattern_first; ++first; } else { result = false; stop = true; } return result; } // glob_potential_match() libclaw-1.7.4/claw/impl/graph.tpp000066400000000000000000000616121216507631600166720ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file graph.tpp * \brief Implementation of the claw::graph class. * \author Julien Jorge */ #include #include #include /*---------------------------------------------------------------------------*/ /** * \brief Default constructor. */ claw::graph_exception::graph_exception() throw() : m_msg("No message") { } // graph_exception() /*---------------------------------------------------------------------------*/ /** * \brief Constructor. * \param s An explanation of the problem. */ claw::graph_exception::graph_exception( const std::string& s) throw() : m_msg(s) { } // graph_exception() /*---------------------------------------------------------------------------*/ /** * \brief Destructor. */ claw::graph_exception::~graph_exception() throw() { } // ~graph_exception() /*---------------------------------------------------------------------------*/ /** * \brief Get an explanation of the problem. */ const char* claw::graph_exception::what() const throw() { return m_msg.c_str(); } // what() /*---------------------------------------------------------------------------*/ /** * \brief Constructor of the graph_vertex_iterator class. */ template claw::graph::graph_vertex_iterator::graph_vertex_iterator() { } // graph_vertex_iterator() [constructor] /*---------------------------------------------------------------------------*/ /** * \brief Preincrement. * \pre Iterator is not at the end of the container. */ template typename claw::graph::graph_vertex_iterator& claw::graph::graph_vertex_iterator::operator++() { ++m_iterator; return *this; } // operator++() [preincrement] /*---------------------------------------------------------------------------*/ /** * \brief Postincrement. * \pre Iterator is not at the end of the container. */ template typename claw::graph::graph_vertex_iterator claw::graph::graph_vertex_iterator::operator++(int) { graph_vertex_iterator it_tmp(*this); m_iterator++; return *this; } // operator++() [postincrement] /*---------------------------------------------------------------------------*/ /** * \brief Predecrement. * \pre Iterator is not at the begining of the container. */ template typename claw::graph::graph_vertex_iterator& claw::graph::graph_vertex_iterator::operator--() { --m_iterator; return *this; } // operator--() [predecrement] /*---------------------------------------------------------------------------*/ /** * \brief Postdecrement. * \pre Iterator is not at the begining of the container. */ template typename claw::graph::graph_vertex_iterator claw::graph::graph_vertex_iterator::operator--(int) { graph_vertex_iterator it_tmp(*this); m_iterator--; return it_tmp; } // operator--() [postdecrement] /*---------------------------------------------------------------------------*/ /** * \brief Dereference. * \pre Iterator is not at the end of the container. */ template typename claw::graph::graph_vertex_iterator::reference claw::graph::graph_vertex_iterator::operator*() const { return m_iterator->first; } // operator*() /*---------------------------------------------------------------------------*/ /** * \brief Reference. * \pre Iterator is not at the end of the container. */ template typename claw::graph::graph_vertex_iterator::pointer claw::graph::graph_vertex_iterator::operator->() const { return &(m_iterator->first); } // operator->() /*---------------------------------------------------------------------------*/ /** * \brief Equality. * \param it Iterator to compare to. * \pre Iterator and it are not at the end of their respective containers. */ template bool claw::graph::graph_vertex_iterator::operator== (const graph_vertex_iterator& it) const { return m_iterator == it.m_iterator; } // operator==() /*---------------------------------------------------------------------------*/ /** * \brief Difference. * \param it Iterator to compare to. * \pre Iterator and it are not at the end of their respective containers. */ template bool claw::graph::graph_vertex_iterator::operator!= (const graph_vertex_iterator& it) const { return m_iterator != it.m_iterator; } // operator!=() /*---------------------------------------------------------------------------*/ /** * \brief Constructor with an iterator on graph class data. * \param it Iterator where scan starts. */ template claw::graph::graph_vertex_iterator::graph_vertex_iterator (typename graph_content::const_iterator it) : m_iterator(it) { } // graph_vertex_iterator() [constructor on an iterator] /*---------------------------------------------------------------------------*/ /** * \brief Constructor. */ template claw::graph::graph_edge_iterator::edge::edge() : m_label(NULL), m_source(NULL), m_target(NULL) { } // edge::edge [constructor] /*---------------------------------------------------------------------------*/ /** * \brief Gets edge's label. */ template const typename claw::graph::edge_type& claw::graph::graph_edge_iterator::edge::label() const { assert(m_label != NULL); return *m_label; } // edge::label() /*---------------------------------------------------------------------------*/ /** * \brief Gets edge's source. */ template const typename claw::graph::vertex_type& claw::graph::graph_edge_iterator::edge::source() const { assert(m_source != NULL); return *m_source; } // edge::source() /*---------------------------------------------------------------------------*/ /** * \brief Gets edge's target. */ template const typename claw::graph::vertex_type& claw::graph::graph_edge_iterator::edge::target() const { assert(m_target != NULL); return *m_target; } // edge::target() /*---------------------------------------------------------------------------*/ /** * \brief Sets label, source and taget. */ template void claw::graph::graph_edge_iterator::edge:: set( const edge_type& l, const vertex_type& s, const vertex_type& t ) { m_label = &l; m_source = &s; m_target = &t; } // edge::set() /*---------------------------------------------------------------------------*/ /** * \brief Constructor of the graph_edge_iterator class. */ template claw::graph::graph_edge_iterator::graph_edge_iterator() { } // graph_edge_iterator() [constructor] /*---------------------------------------------------------------------------*/ /** * \brief Preincrement. * \pre Iterator is not at the end of the container. */ template typename claw::graph::graph_edge_iterator& claw::graph::graph_edge_iterator::operator++() { bool ok = true; ++m_neighbours_iterator; // end of a neighbourhood if ( m_neighbours_iterator == m_vertex_iterator->second.end() ) { // find next edge or end. ok = false; ++m_vertex_iterator; while ( (m_vertex_iterator != m_vertex_end) && !ok ) if ( !m_vertex_iterator->second.empty() ) { ok = true; m_neighbours_iterator = m_vertex_iterator->second.begin(); } else ++m_vertex_iterator; } if (ok) m_edge.set( m_neighbours_iterator->second, m_vertex_iterator->first, m_neighbours_iterator->first ); return *this; } // operator++() [preincrement] /*---------------------------------------------------------------------------*/ /** * \brief Postincrement. * \pre Iterator is not at the end of the container. */ template typename claw::graph::graph_edge_iterator claw::graph::graph_edge_iterator::operator++(int) { graph_edge_iterator it_tmp(*this); ++(*this); return it_tmp; } // operator++() [postincrement] /*---------------------------------------------------------------------------*/ /** * \brief Predecrement. * \pre Iterator is not at the begining of the container. */ template typename claw::graph::graph_edge_iterator& claw::graph::graph_edge_iterator::operator--() { bool ok = true; if (m_vertex_iterator == m_vertex_end) { --m_vertex_iterator; m_neighbours_iterator = m_vertex_iterator->second.end(); } // begining of a neighbourhood if ( m_neighbours_iterator == m_vertex_iterator->second.begin() ) { ok = false; // find previous edge or begining. while ( (m_vertex_iterator != m_vertex_begin) && !ok ) { --m_vertex_iterator; if ( !m_vertex_iterator->second.empty() ) { ok = true; m_neighbours_iterator = --m_vertex_iterator->second.end(); } } } else --m_neighbours_iterator; if (!ok) m_vertex_iterator == m_vertex_end; else m_edge.set( m_neighbours_iterator->second, m_vertex_iterator->first, m_neighbours_iterator->first ); return *this; } // operator--() [predecrement] /*---------------------------------------------------------------------------*/ /** * \brief postdecrement. * \pre Iterator is not at the begining of the container. */ template typename claw::graph::graph_edge_iterator claw::graph::graph_edge_iterator::operator--(int) { graph_edge_iterator it_tmp(*this); --(*this); return it_tmp; } // operator--() [postdecrement] /*---------------------------------------------------------------------------*/ /** * \brief Reference. * \pre Iterator is not at the end of the container. */ template typename claw::graph::graph_edge_iterator::reference claw::graph::graph_edge_iterator::operator*() const { return m_edge; } // operator*() /*---------------------------------------------------------------------------*/ /** * \brief Pointer. * \pre Iterator is not at the end of the container. */ template typename claw::graph::graph_edge_iterator::pointer claw::graph::graph_edge_iterator::operator->() const { return &m_edge; } // operator->() /*---------------------------------------------------------------------------*/ /** * \brief Equality. * \param it Iterator to compare to. * \pre Iterator and it are not at the end of their respective containers. */ template bool claw::graph::graph_edge_iterator::operator== (const graph_edge_iterator& it) const { // both are empty if ( m_vertex_begin == m_vertex_end ) return (it.m_vertex_begin == it.m_vertex_end) && (m_vertex_begin == it.m_vertex_begin); else if ( it.m_vertex_begin == it.m_vertex_end ) // -it- is empty return false; else // none is empty, perheaps at the end ? if (m_vertex_iterator == m_vertex_end) return (it.m_vertex_iterator == it.m_vertex_end) && (m_vertex_begin == it.m_vertex_begin); else if (it.m_vertex_iterator == it.m_vertex_end) return false; else return m_neighbours_iterator == it.m_neighbours_iterator; } // operator==() /*---------------------------------------------------------------------------*/ /** * \brief Difference. * \param it Iterator to compare to. * \pre Iterator and it are not at the end of their respective containers. */ template bool claw::graph::graph_edge_iterator::operator!= (const graph_edge_iterator& it) const { return !(*this == it); } // operator!=() /*---------------------------------------------------------------------------*/ /** * \brief Constructor with an iterator on graph class data. * \param it_begin Iterator on the first node. * \param it_end Iterator on the last node. * \param it_s Iterator on current edge's source. * \param it_d Iterator where scan starts. */ template claw::graph::graph_edge_iterator::graph_edge_iterator ( typename graph_content::const_iterator it_begin, typename graph_content::const_iterator it_end, typename graph_content::const_iterator it_s, typename neighbours_list::const_iterator it_d) : m_vertex_begin(it_begin), m_vertex_end(it_end), m_vertex_iterator(it_s), m_neighbours_iterator(it_d) { if (m_vertex_begin != m_vertex_end) m_edge.set( m_neighbours_iterator->second, m_vertex_iterator->first, m_neighbours_iterator->first ); } // graph_edge_iterator() [constructor on an iterator] /*---------------------------------------------------------------------------*/ /** * \brief Constructor. */ template claw::graph::graph() : m_edges_count(0) { } // graph::graph() [constructor] /*---------------------------------------------------------------------------*/ /** * \brief Add an edge in the graph. * \param s1 Tail of the edge. * \param s2 Head of the edgre. * \param e The label on the edge. */ template void claw::graph::add_edge ( const vertex_type& s1, const vertex_type& s2, const edge_type& e ) { if ( !edge_exists(s1, s2) ) { // s2 is not a neighbor of s1 ++m_edges_count; add_vertex(s1); add_vertex(s2); // in all cases, s2 as one more inner edge ++m_inner_degrees[s2]; } m_edges[s1][s2] = e; } // graph::add_edge() /*---------------------------------------------------------------------------*/ /** * \brief Add a vertex. * \param s The vertex to add. */ template void claw::graph::add_vertex( const vertex_type& s ) { std::pair p; if (m_edges.find(s) == m_edges.end()) { // Add the vertex in the adjacency list. p.first = s; m_edges.insert(p); m_inner_degrees[s] = 0; } } // graph::add_vertex() /*---------------------------------------------------------------------------*/ /** * \brief Check if there is an edge linking to vertices. * \param s Vertex at the tail of the edge. * \param r Vertex at the head of the edge. */ template bool claw::graph::edge_exists ( const vertex_type& s, const vertex_type& r ) const { typename graph_content::const_iterator it = m_edges.find(s); if ( it == m_edges.end() ) return false; else return it->second.find(r) != it->second.end(); } // graph::edge_exists() /*---------------------------------------------------------------------------*/ /** * \brief Get the neighbors of a vertex. * \param s The vertex. * \param v (out) The neighbors. */ template void claw::graph::neighbours (const vertex_type& s, std::vector& v) const { typename graph_content::const_iterator it_s = m_edges.find(s); v.clear(); if ( it_s != m_edges.end() ) { v.resize( it_s->second.size() ); std::transform( it_s->second.begin(), it_s->second.end(), v.begin(), const_first() ); } } // graph::neighbours() /*---------------------------------------------------------------------------*/ /** * \brief Get all the vertices. * \param v (out) The vertices. */ template void claw::graph::vertices(std::vector& v) const { v.clear(); v.resize(m_edges.size()); std::transform( m_edges.begin(), m_edges.end(), v.begin(), const_first() ); } // graph::vertices() /*---------------------------------------------------------------------------*/ /** * \brief Get a node iterator on the first node. * \remark Returns vertex_end() if graph is empty. */ template typename claw::graph::vertex_iterator claw::graph::vertex_begin() const { return vertex_iterator( m_edges.begin() ); } // graph::vertex_begin() /*---------------------------------------------------------------------------*/ /** * \brief Get a node iterator past the last node. */ template typename claw::graph::vertex_iterator claw::graph::vertex_end() const { return vertex_iterator( m_edges.end() ); } // graph::vertex_end() /*---------------------------------------------------------------------------*/ /** * \brief Get a node iterator on a particular node. * \remark Returns vertex_end() if S is not found. */ template typename claw::graph::vertex_iterator claw::graph::vertex_begin( const vertex_type& s ) const { return vertex_iterator( m_edges.find(s) ); } // graph::vertex_begin() /*---------------------------------------------------------------------------*/ /** * \brief Get a reverse node iterator on the first node. * \remark Returns vertex_rend() if graph is empty. */ template typename claw::graph::reverse_vertex_iterator claw::graph::vertex_rbegin() const { return reverse_vertex_iterator( vertex_end() ); } // graph::vertex_rbegin() /*---------------------------------------------------------------------------*/ /** * \brief Get a reverse node iterator past the last node. */ template typename claw::graph::reverse_vertex_iterator claw::graph::vertex_rend() const { return reverse_vertex_iterator( vertex_begin() ); } // graph::vertex_rend() /*---------------------------------------------------------------------------*/ /** * \brief Get a reverse node iterator just after a particular node. * \remark Returns vertex_rend() if s is not found. */ template typename claw::graph::reverse_vertex_iterator claw::graph::vertex_rbegin( const vertex_type& s ) const { vertex_iterator it = vertex_begin(s); if (it != vertex_end()) ++it; return reverse_vertex_iterator( it ); } // graph::vertex_rbegin() /*---------------------------------------------------------------------------*/ /** * \brief Get an edge iterator on the first edge. * \remark Returns edge_end() if there's no edge in the graph. */ template typename claw::graph::edge_iterator claw::graph::edge_begin() const { bool ok = false; typename graph_content::const_iterator it_s; it_s = m_edges.begin(); while ( (it_s != m_edges.end()) && !ok ) if ( it_s->second.empty() ) ++it_s; else ok = true; if (ok) return edge_iterator( m_edges.begin(), m_edges.end(), it_s, it_s->second.begin() ); else return edge_end(); } // graph::edge_begin() /*---------------------------------------------------------------------------*/ /** * \brief Get an edge iterator after the last edge. */ template typename claw::graph::edge_iterator claw::graph::edge_end() const { return edge_iterator( m_edges.begin(), m_edges.end(), m_edges.end(), typename neighbours_list::const_iterator() ); } // graph::edge_end() /*---------------------------------------------------------------------------*/ /** * \brief Get en iterator on a particular edge . * \remark Returns edge_end() if edge (s1,s2) is not found. */ template typename claw::graph::edge_iterator claw::graph::edge_begin ( const vertex_type& s1, const vertex_type& s2 ) const { if ( edge_exists(s1, s2) ) { typename graph_content::const_iterator it_s1; it_s1 = m_edges.find(s1); return edge_iterator( m_edges.begin(), m_edges.end(), it_s1, it_s1->second.find(s2) ); } else return edge_end(); } // graph::edge_() /*---------------------------------------------------------------------------*/ /** * \brief Get a reverse edge iterator on the first edge. * \remark Returns redge_end() if there's no edge in the graph. */ template typename claw::graph::reverse_edge_iterator claw::graph::edge_rbegin() const { return reverse_edge_iterator( edge_end() ); } // graph::edge_rbegin() /*---------------------------------------------------------------------------*/ /** * \brief Get a reverse edge iterator after the last edge. */ template typename claw::graph::reverse_edge_iterator claw::graph::edge_rend() const { return reverse_edge_iterator( edge_begin() ); } // graph::edge_rend() /*---------------------------------------------------------------------------*/ /** * \brief Get a reverse edge iterator on a particular edge. * \remark Returns redge_end() if edge (s1,s2) is not found. */ template typename claw::graph::reverse_edge_iterator claw::graph::edge_rbegin ( const vertex_type& s1, const vertex_type& s2 ) const { reverse_edge_iterator it = edge_begin(s1, s2); if ( it != edge_end() ) ++it; return reverse_edge_iterator( it ); } // graph::edge_rbegin() /*---------------------------------------------------------------------------*/ /** * \brief Get the label of an edge. * \param s The vertex at the tail of the edge. * \param r The vertex at the head of the edge. */ template const typename claw::graph::edge_type& claw::graph::label ( const vertex_type& s, const vertex_type& r ) const { typename graph_content::const_iterator it_s = m_edges.find(s); if ( it_s == m_edges.end() ) throw graph_exception ("claw::graph::label(): unkonwn source vertex."); else { typename neighbours_list::const_iterator it_r = it_s->second.find(r); if ( it_r == it_s->second.end() ) throw graph_exception ("claw::graph::label(): destination is not a neighbor."); else return it_r->second; } } // graph::label() /*---------------------------------------------------------------------------*/ /** * \brief Get the outter degree of a vertex. * \param s The vertex. */ template std::size_t claw::graph::outer_degree( const vertex_type& s ) const { typename graph_content::const_iterator it = m_edges.find(s); if (it == m_edges.end()) throw graph_exception("claw::graph::outer_degree(): unknown vertex."); else return it->second.size(); } // graph::outer_degree() /*---------------------------------------------------------------------------*/ /** * \brief Get the inner degree of a vertex. * \param s The vertex */ template std::size_t claw::graph::inner_degree( const vertex_type& s ) const { typename std::map::const_iterator it; it = m_inner_degrees.find(s); if (it == m_inner_degrees.end()) throw graph_exception ("claw::graph::inner_degree(): unkown vertex."); else return it->second; } // graph::inner_degree() /*---------------------------------------------------------------------------*/ /** * \brief Get the number of vertices. */ template std::size_t claw::graph::vertices_count() const { return m_edges.size(); } // graph::vertices_count() /*---------------------------------------------------------------------------*/ /** * \brief Get the number of edges. */ template std::size_t claw::graph::edges_count() const { return m_edges_count; } // graph::edges_count() libclaw-1.7.4/claw/impl/graph_algorithm.tpp000066400000000000000000000144441216507631600207410ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file graph_algorithm.tpp * \brief Graph algorithms implementation. * \author Julien Jorge */ #include #include /*---------------------------------------------------------------------------*/ /** * \brief Constructor. * \param g Graph to scan. * \param source Start_Vertexing vertex. * \param events User's processings. */ template claw::breadth_scan::breadth_scan( const Graph& g, const vertex_type& source, Events& events ) : m_g(g), m_source(source), m_events(events) { } // breadth_scan::breadth_scan() [constructor] /*---------------------------------------------------------------------------*/ /** * \brief Performs the scan. */ template void claw::breadth_scan::operator()() { coloration seen_vertices; std::queue pending_vertices; vertex_type current_vertex; std::vector neighbourhood; typename std::vector::const_iterator it; m_events.init(m_g); for (vertex_iterator it_v=m_g.vertex_begin(); it_v!=m_g.vertex_end(); ++it_v) seen_vertices[*it_v] = 0; seen_vertices[m_source] = 1; pending_vertices.push( m_source ); while ( !pending_vertices.empty() ) { current_vertex = pending_vertices.front(); m_events.start_vertex(current_vertex); m_g.neighbours( current_vertex, neighbourhood ); for( it = neighbourhood.begin(); it != neighbourhood.end(); ++it ) { if ( seen_vertices[*it] == 0 ) { m_events.visit_edge(current_vertex, *it); seen_vertices[*it] = 1; } } pending_vertices.pop(); m_events.end_vertex( current_vertex ); seen_vertices[current_vertex] = 2; } } // breadth_scan::operator() //****************************** depth_scan *********************************** /*---------------------------------------------------------------------------*/ /** * \brief Constructor. * \param g Graph to scan. * \param events User's processings. */ template claw::depth_scan::depth_scan( const Graph& g, Events& events ) : m_g(g), m_events(events) { } // depth_scan::depth_scan() [constructor] /*---------------------------------------------------------------------------*/ /** * \brief Performs the scan. */ template void claw::depth_scan::operator()() { coloration seen_vertices; vertex_iterator it; m_events.init(m_g); for (it=m_g.vertex_begin(); it!=m_g.vertex_end(); ++it) seen_vertices[*it] = 0; for (it = m_g.vertex_begin(); it!=m_g.vertex_end(); ++it) if ( seen_vertices[*it] == 0 ) recursive_scan( *it, seen_vertices ); } // depth_scan::operator()() /*---------------------------------------------------------------------------*/ /** * \brief Performs the recursive part of the scan. */ template void claw::depth_scan::recursive_scan ( const vertex_type& s, coloration& seen_vertices ) { std::vector neighbourhood; typename std::vector::const_iterator it; m_events.start_vertex(s); seen_vertices[s] = 1; m_g.neighbours( s, neighbourhood ); for( it = neighbourhood.begin(); it != neighbourhood.end(); ++it ) if ( seen_vertices[*it] == 0 ) { m_events.visit_edge(s, *it); recursive_scan( *it, seen_vertices ); } m_events.end_vertex(s); seen_vertices[s] = 2; } // depth_scan::operator() //********************** topological_sort *********************************** /*---------------------------------------------------------------------------*/ /** * \brief Initialize the scan. * \param g The graph that will be scanned. */ template void claw::topological_sort::init( const Graph& g ) { m_result.resize( g.vertices_count() ); m_next_index = (int)g.vertices_count()-1; } // topological_sort::init() #include /*---------------------------------------------------------------------------*/ template void claw::topological_sort::end_vertex( const vertex_type& s ) { m_result[m_next_index] = s; --m_next_index; } // topological_sort::end() /*---------------------------------------------------------------------------*/ template void claw::topological_sort::operator()( const Graph& g ) { claw::depth_scan< Graph, self_type > scan( g, *this ); scan(); } // topological_sort::operator()() /*---------------------------------------------------------------------------*/ template const typename claw::topological_sort::vertex_type & claw::topological_sort::operator[](unsigned int index) const { return m_result[index]; } // topological_sort::operator[]() /*---------------------------------------------------------------------------*/ template typename claw::topological_sort::const_iterator claw::topological_sort::begin() const { return m_result.begin(); } // topological_sort::begin() /*---------------------------------------------------------------------------*/ template typename claw::topological_sort::const_iterator claw::topological_sort::end() const { return m_result.end(); } // topological_sort::end() libclaw-1.7.4/claw/impl/image.ipp000066400000000000000000000320631216507631600166360ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2009 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien_jorge@yahoo.fr */ /** * \file image.ipp * \brief Inline methods for the claw::graphic::image class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Get a pixel from the line. * \param i The index of the pixel. */ claw::graphic::image::scanline::reference inline claw::graphic::image::scanline::operator[](unsigned int i) { return super::operator[](i); } // image::scanline::operator[]() /*----------------------------------------------------------------------------*/ /** * \brief Get a pixel from the line. * \param i The index of the pixel. */ claw::graphic::image::scanline::const_reference inline claw::graphic::image::scanline::operator[](unsigned int i) const { return super::operator[](i); } // image::scanline::operator[]() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ template inline claw::graphic::image::base_iterator::base_iterator() : m_owner(NULL), m_pos(0, 0) { CLAW_POSTCOND(is_final()); } // image::base_iterator::base_iterator() /*----------------------------------------------------------------------------*/ /** * \brief Constructor, from an image. * \param owner The image we will iterate through. * \param x X-coordinate of the pointed pixel. * \param y Y-coordinate of the pointed pixel. */ template inline claw::graphic::image::base_iterator::base_iterator ( image_type& owner, unsigned int x, unsigned int y ) : m_owner(&owner), m_pos(x, y) { } // image::base_iterator::base_iterator() /*----------------------------------------------------------------------------*/ /** * \brief Tell if two iterator point to the same address. * \param that The other operand. */ template inline bool claw::graphic::image::base_iterator::operator== ( const self_type& that ) const { if ( is_final() && that.is_final() ) return true; else if ( m_owner == that.m_owner ) return m_pos == that.m_pos; else return false; } // image::base_iterator::operator==() /*----------------------------------------------------------------------------*/ /** * \brief Tell if two iterator points to different addresses. * \param that The other operand. */ template inline bool claw::graphic::image::base_iterator::operator!= ( const self_type& that ) const { return !(*this == that); } // image::base_iterator::operator!=() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the current iterator is before an other. * \param that The other operand. */ template inline bool claw::graphic::image::base_iterator::operator< ( const self_type& that ) const { if ( this->m_pos.y == that.m_pos.y) return this->m_pos.x < that.m_pos.x; else return this->m_pos.y < that.m_pos.y; } // image::base_iterator::operator<() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the current iterator is after an other. * \param that The other operand. */ template inline bool claw::graphic::image::base_iterator::operator> ( const self_type& that ) const { return that < *this; } // image::base_iterator::operator>() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the current iterator is before an other, or on the same * address. * \param that The other operand. */ template inline bool claw::graphic::image::base_iterator::operator<= ( const self_type& that ) const { return !(*this > that); } // image::base_iterator::operator<=() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the current iterator is after an other, or on the same * address. * \param that The other operand. */ template inline bool claw::graphic::image::base_iterator::operator>= ( const self_type& that ) const { return !(*this < that); } // image::base_iterator::operator>=() /*----------------------------------------------------------------------------*/ /** * \brief Move the iterator. * \param n Number of steps of the move. */ template inline typename claw::graphic::image::base_iterator::self_type& claw::graphic::image::base_iterator::operator+=( int n ) { if (n < 0) return *this -= -n; else { CLAW_PRECOND( !is_final() ); unsigned int n_y = n / m_owner->width(); unsigned int n_x = n % m_owner->width(); m_pos.x += n_x; m_pos.y += n_y; return *this; } } // image::base_iterator::operator+=() /*----------------------------------------------------------------------------*/ /** * \brief Move the iterator. * \param n Number of steps of the move. */ template inline typename claw::graphic::image::base_iterator::self_type& claw::graphic::image::base_iterator::operator-=( int n ) { if (n < 0) return *this += -n; else { CLAW_PRECOND( m_owner ); unsigned int n_y = n / m_owner->width(); unsigned int n_x = n % m_owner->width(); CLAW_PRECOND( m_pos.x >= n_x ); CLAW_PRECOND( m_pos.y >= n_y ); m_pos.x -= n_x; m_pos.y -= n_y; return *this; } } // image::base_iterator::operator-=() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator at a specific distance of the current iterator. * \param n The distance of the wanted iterator. */ template inline typename claw::graphic::image::base_iterator::self_type claw::graphic::image::base_iterator::operator+( int n ) const { self_type that(*this); return that += n; } // image::base_iterator::operator+() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator at a specific distance of the current iterator. * \param n The distance of the wanted iterator. */ template inline typename claw::graphic::image::base_iterator::self_type claw::graphic::image::base_iterator::operator-( int n ) const { self_type that(*this); return that -= n; } // image::base_iterator::operator-() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator at a specific distance of the current iterator. * \param n The distance of the wanted iterator. * \param self The reference iterator. */ template inline typename claw::graphic::image::base_iterator::self_type operator+ ( int n, const typename claw::graphic::image::base_iterator::self_type& self ) { return self + n; } // image::base_iterator::operator+() /*----------------------------------------------------------------------------*/ /** * \brief Get the distance between two iterators. * \param that The other operand. */ template inline typename claw::graphic::image::base_iterator::difference_type claw::graphic::image::base_iterator::operator- ( const self_type& that ) const { CLAW_PRECOND( is_final() || that.is_final() || (m_owner == that.m_owner) ); if ( that.is_final() ) { if ( is_final() ) return 0; else return -(m_owner->height() - m_pos.y) * m_owner->width() - m_pos.x; } else if ( is_final() ) return (that.m_owner->height() - that.m_pos.y) * that.m_owner->width() + that.m_pos.x; else return m_pos.y * m_owner->width() + m_pos.x - that.m_pos.y * that.m_owner->width() + that.m_pos.x; } // image::base_iterator::operator-() /*----------------------------------------------------------------------------*/ /** * \brief Preincrement. */ template inline typename claw::graphic::image::base_iterator::self_type& claw::graphic::image::base_iterator::operator++() { CLAW_PRECOND( !is_final() ); ++m_pos.x; if ( m_pos.x == m_owner->width() ) { m_pos.x = 0; ++m_pos.y; } return *this; } // image::base_iterator::operator++() /*----------------------------------------------------------------------------*/ /** * \brief Postincrement. */ template inline typename claw::graphic::image::base_iterator::self_type claw::graphic::image::base_iterator::operator++(int) { self_type that(*this); ++(*this); return that; } // image::base_iterator::operator++() [postincrement] /*----------------------------------------------------------------------------*/ /** * \brief Predecrement. */ template inline typename claw::graphic::image::base_iterator::self_type& claw::graphic::image::base_iterator::operator--() { CLAW_PRECOND( !is_final() ); CLAW_PRECOND( (m_pos.y > 0) || (m_pos.x > 0) ); if ( m_pos.x == 0 ) { m_pos.x = m_owner->width() - 1; --m_pos.y; } else --m_pos.x; return *this; } // image::base_iterator::operator--() /*----------------------------------------------------------------------------*/ /** * \brief Postdecrement. */ template inline typename claw::graphic::image::base_iterator::self_type claw::graphic::image::base_iterator::operator--(int) { self_type that(*this); --(*this); return that; } // image::base_iterator::operator--() [postdecrement] /*----------------------------------------------------------------------------*/ /** * \brief Get a reference on the pointed pixel. */ template inline typename claw::graphic::image::base_iterator::reference claw::graphic::image::base_iterator::operator*() const { CLAW_PRECOND( !is_final() ); return (*m_owner)[m_pos.y][m_pos.x]; } // image::base_iterator::operator*() /*----------------------------------------------------------------------------*/ /** * \brief Get a pointer on the pointed pixel. */ template inline typename claw::graphic::image::base_iterator::pointer claw::graphic::image::base_iterator::operator->() const { CLAW_PRECOND( !is_final() ); return &(*m_owner)[m_pos.y][m_pos.x]; } // image::base_iterator::operator->() /*----------------------------------------------------------------------------*/ /** * \brief Get a pixel, using the iterator like an array. * \param n Index of the cell from which we want the pixel. */ template inline typename claw::graphic::image::base_iterator::reference claw::graphic::image::base_iterator::operator[]( int n ) const { return *(*this + n); } // image::base_iterator::operator[]() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the iterator is past the end of its owner. */ template inline bool claw::graphic::image::base_iterator::is_final() const { if ( !m_owner ) return true; else if ( m_pos.y >= m_owner->height() ) return true; else if ( m_pos.y == m_owner->height() - 1 ) return m_pos.x >= m_owner->width(); else return false; } // image::base_iterator::is_final() /*----------------------------------------------------------------------------*/ /** * \brief Gets a line of the image. */ inline claw::graphic::image::scanline& claw::graphic::image::operator[](unsigned int i) { return m_data[i]; } // image::operator[]() /*----------------------------------------------------------------------------*/ /** * \brief Gets a line of the image. */ inline const claw::graphic::image::scanline& claw::graphic::image::operator[](unsigned int i) const { return m_data[i]; } // image::operator[]() [const] libclaw-1.7.4/claw/impl/isocket_stream.tpp000066400000000000000000000101161216507631600205760ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file isocket_stream.tpp * \brief Implementation of the claw::net::basic_isocket_stream class. * \author Julien Jorge */ /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ template claw::net::basic_isocket_stream::basic_isocket_stream() : super(&m_buffer) { } // basic_isocket_stream::basic_isocket_stream() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param address The address to which we will connect. * \param port The port number to use for the connection. */ template claw::net::basic_isocket_stream::basic_isocket_stream ( const std::string& address, int port ) : super(&m_buffer) { open(address, port); } // basic_isocket_stream::basic_isocket_stream() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ template claw::net::basic_isocket_stream::~basic_isocket_stream() { // nothing to do } // basic_isocket_stream::~basic_isocket_stream() /*----------------------------------------------------------------------------*/ /** * \brief Get the input buffer. */ template typename claw::net::basic_isocket_stream::buffer_type* claw::net::basic_isocket_stream::rdbuf() const { return const_cast(&m_buffer); } // basic_isocket_stream::rdbuf() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the stream is open. */ template bool claw::net::basic_isocket_stream::is_open() const { return m_buffer.is_open(); } // basic_isocket_stream::() /*----------------------------------------------------------------------------*/ /** * \brief Connect the socket to an address. * \param address The address to which we will connect. * \param port The port number to use for the connection. */ template void claw::net::basic_isocket_stream::open ( const std::string& address, int port ) { if ( !m_buffer.open(address, port) ) this->setstate(std::ios_base::failbit); else this->clear(); } // basic_isocket_stream::open() /*----------------------------------------------------------------------------*/ /** * \brief Link the socket to a file descriptor. * \param fd The file descriptor. * \remark This method should be only called by claw::net::socket_server. */ template void claw::net::basic_isocket_stream::open( int fd ) { if ( !m_buffer.open(fd) ) this->setstate(std::ios_base::failbit); else this->clear(); } // basic_isocket_stream::open() /*----------------------------------------------------------------------------*/ /** * \brief Close the connection. */ template void claw::net::basic_isocket_stream::close() { if ( !m_buffer.close() ) this->setstate(std::ios_base::failbit); } // basic_isocket_stream::close() libclaw-1.7.4/claw/impl/jpeg_reader.tpp000066400000000000000000000045071216507631600200400ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file jpeg_reader.tpp * \brief Implementation of the template methods of the * claw::graphic::jpeg::reader class. * \author Julien Jorge */ #include #include /*----------------------------------------------------------------------------*/ /** * \brief Decompress a RGB jpeg image. * \param cinfo Informations about the decompression process. * \param pixel_convert Operator to use to convert pixels from input. */ template void claw::graphic::jpeg::reader::read_data ( jpeg_decompress_struct& cinfo, const Convert& pixel_convert ) { const unsigned int pixel_size = cinfo.output_components; JSAMPLE* buffer = new JSAMPLE[cinfo.output_width * pixel_size]; error_manager jerr; jpeg_error_mgr* jerr_saved = cinfo.err; cinfo.err = jpeg_std_error(&jerr.pub); jerr.pub.error_exit = jpeg__error_manager__error_exit; if ( setjmp(jerr.setjmp_buffer) ) { delete[] buffer; throw CLAW_EXCEPTION(jerr.error_string); } while (cinfo.output_scanline < cinfo.output_height) { jpeg_read_scanlines(&cinfo, &buffer, 1); scanline::iterator pixel = m_image[cinfo.output_scanline-1].begin(); for ( unsigned int i=0; i!=pixel_size*m_image.width(); i+=pixel_size, ++pixel ) *pixel = pixel_convert( &buffer[i] ); } delete[] buffer; cinfo.err = jerr_saved; } // jpeg::reader::read_data() libclaw-1.7.4/claw/impl/kmp.tpp000066400000000000000000000153531216507631600163610ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file kmp.tpp * \brief Implementation of the kmp class. * \author Julien Jorge */ #include #include #include /*---------------------------------------------------------------------------*/ /** * \brief Calculate the length of the longest common prefix between two * patterns. * \param begin_1 Iterator on the first item in the first pattern. * \param begin_2 Iterator on the first item in the second pattern. * \param end_1 Iterator after the last item in the first pattern. * \param end_2 Iterator after the last item in the second pattern. */ template unsigned int claw::text::kmp:: common_prefix_length( const RandomIterator begin_1, const RandomIterator begin_2, const RandomIterator end_1, const RandomIterator end_2 ) const { unsigned int count = 0; RandomIterator it_1 = begin_1, it_2 = begin_2; bool quit = false; while ( (it_1 != end_1) && (it_2 != end_2) && ! quit ) if ( *it_1 == *it_2 ) { ++it_1; ++it_2; ++count; } else quit = true; return count; } // common_prefix_length() /*---------------------------------------------------------------------------*/ /** * \brief Preprocessing. Calculate the pattern's z-boxes. * \param begin Iterator on the first item in the pattern. * \param end Iterator after the last item in the pattern. * \param out (out) Calculated z-boxes. * \remark out contains only non-zero z-boxes. */ template void claw::text::kmp::z_boxes(const RandomIterator begin, const RandomIterator end, std::map& out) const { // right and left bounds of the current item's Z-box. claw::it_index it_r(begin); claw::it_index it_l(begin); claw::it_index it_k(begin); // increment on the items unsigned int z; // le Zi of the current position for (++it_k; it_k!=end; ++it_k) { if (it_k > it_r) { z = common_prefix_length(begin, it_k, end, end); if ( z > 0 ) // set the Z-box { out[it_k] = z; it_l = it_k; it_r = it_k.operator+(z) - 1; } } else /* k <= r */ { unsigned int k_bis = it_k - it_l; claw::it_index it_b(it_r - it_k); if ( out.find(k_bis) == out.end() ) z = 0; else z = out[k_bis]; if ( z <= (unsigned int)it_b ) { if ( z > 0 ) out[it_k] = z; } else { claw::it_index it_q = it_r + 1; it_q += common_prefix_length(it_q, it_b+1, end, end); out[it_k] = it_q - it_k; it_r = it_q - 1; it_l = it_k; } } } } // z_boxes() /*---------------------------------------------------------------------------*/ /** * \brief Preprocessing. Calculate the pattern's spi' values. * \param begin Iterator on the first item in the pattern. * \param end Iterator after the last item in the pattern. * \param out (out) Calculated spi'. * \remark out contains only non-zero spi'. */ template void claw::text::kmp::spi_prime(const RandomIterator begin, const RandomIterator end, std::map& out) const { std::map z; // pattern's Z-boxes. unsigned int j; // loop index. // set Z-boxes z_boxes(begin, end, z); // calculates spi' (from end to begining) j=end-begin; do { --j; if (z.find(j) != z.end()) out[j + z[j] - 1] = z[j]; } while (j!=0); } // spi_prime() /*---------------------------------------------------------------------------*/ /** * \brief Pattern matching with the Knuth-Morris-Pratt's algorithm. * \param pattern_begin Iterator on the first item in the pattern. * \param pattern_end Iterator after the last item in the pattern. * \param text_begin Iterator on the first item in the text. * \param text_end Iterator after the last item in the text. * \param action Predicate called with the last found position for the pattern. * \remark Exits if action return false. * \pre pattern_begin != pattern_end */ template template void claw::text::kmp::operator() (const RandomIterator pattern_begin, const RandomIterator pattern_end, const RandomIterator text_begin, const RandomIterator text_end, UnaryPredicate& action ) const { std::map spi; // pattern's spi' claw::it_index it_p(pattern_begin,1); claw::it_index it_t(text_begin,1); bool stop = false; // result of the last call to the predicate action const int pattern_length = pattern_end - pattern_begin; const int text_length = text_end - text_begin; assert(pattern_begin != pattern_end); spi_prime(pattern_begin, pattern_end, spi); unsigned int i = 0; while ( ((int)it_t <= text_length - (pattern_length - it_p)) && !stop ) { unsigned int common; common = common_prefix_length(it_p, it_t, pattern_end, text_end); i += common; it_p += common; it_t += common; if (it_p == 1) ++it_t; else { if ( (int)it_p == pattern_length+1 ) stop = !action( (int)it_t - pattern_length-1 ); i = spi[i-1]; it_p.set(pattern_begin+i, i+1); } } } // operator() libclaw-1.7.4/claw/impl/line_2d.tpp000066400000000000000000000107351216507631600171050ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file line_2d.tpp * \brief Implementation of claw::math::line_2d class. * \author Julien Jorge */ /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ template claw::math::line_2d::line_2d() { } // line_2d::line_2d() [constructor] /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param that Line to copy from. */ template template claw::math::line_2d::line_2d( const line_2d& that ) : origin(that.origin), direction(that.direction) { } // line_2d::line_2d() [copy constructor] /*----------------------------------------------------------------------------*/ /** * \brief Constructor with initializations. * \param _origin A point on the line. * \param _direction The direction of the line. */ template claw::math::line_2d::line_2d ( const point_type& _origin, const direction_type& _direction ) : origin(_origin), direction(_direction) { } // line_2d::line_2d() [constructor with values] /*----------------------------------------------------------------------------*/ /** * \brief Constructor with initializations. * \param ox X-coordinate of the origin. * \param oy Y-coordinate of the origin. * \param dx X direction of the line. * \param dy Y direction of the line. */ template claw::math::line_2d::line_2d( const value_type& ox, const value_type& oy, const value_type& dx, const value_type& dy ) : origin(ox, oy), direction(dx, dy) { } // line_2d::line_2d() [constructor with detailed origin & direction] /*----------------------------------------------------------------------------*/ /** * \brief Tell if two lines are parallels. * \param that The other line. */ template bool claw::math::line_2d::parallel( const self_type& that ) const { return !( (direction.x * that.direction.y) - (that.direction.x * direction.y) ); } // line_2d::parallel() /*----------------------------------------------------------------------------*/ /** * \brief Tell if two lines are orthogonal. * \param that The other line. */ template bool claw::math::line_2d::orthogonal( const self_type& that ) const { return !( direction.dot_product( that.direction ) ); } // line_2d::orthogonal() /*----------------------------------------------------------------------------*/ /** * \brief Get the point at the intersection of two lines. * \param that The other line. * \remark The result if unknow if the two lines are parallel. */ template typename claw::math::line_2d::point_type claw::math::line_2d::intersection( const self_type& that ) const { point_type result; if ( ! parallel( that ) ) { point_type delta( that.origin - origin ); value_type n, m; n = direction.x * delta.y - direction.y * delta.x; m = that.direction.x * direction.y - direction.x * that.direction.y; result.x = that.origin.x + (n * that.direction.x) / m; result.y = that.origin.y + (n * that.direction.y) / m; } return result; } // line_2d::intersection() /*----------------------------------------------------------------------------*/ /** * \brief Get the y value of the point of the line at position \a x. * \param x The X-coordinate for which we want the Y-coordinate. */ template typename claw::math::line_2d::value_type claw::math::line_2d::y_value( const value_type& x ) const { return (direction.y * (x - origin.x) + direction.x * origin.y) / direction.x; } // line_2d::y_value() libclaw-1.7.4/claw/impl/logger.tpp000066400000000000000000000031761216507631600170510ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file logger.tpp * \brief Template methods for the claw::log_system class. * \author Julien Jorge */ #include /*---------------------------------------------------------------------------*/ /** * \brief Log something. * \param t The thing to log... * \remark T must support operator<<(std::ostream&, const T&); */ template claw::log_system& claw::log_system::operator<<( const T& t ) { if (m_message_level <= m_log_level) { std::ostringstream oss; oss << t; typename stream_list_type::iterator it; for (it = m_stream.begin(); it!=m_stream.end(); ++it) (*it)->write(oss.str()); } return *this; } // log_system::operator<<() libclaw-1.7.4/claw/impl/lzw_decoder.tpp000066400000000000000000000100441216507631600200630ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file lzw_decoder.tpp * \brief Implementation of the claw::lzw_decoder class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Decode a sequence of LZW compressed datas. * \param input Where we read the compressed datas. * \param output Where we write uncompressed datas. */ template void claw::lzw_decoder::decode ( input_buffer_type& input, output_buffer_type& output ) { const unsigned int symbols_count = input.symbols_count(); table_type table; unsigned int table_size = 0; unsigned int prefix = input.get_next(); if ( !input.end_of_data() ) { while ( !input.end_of_data() ) { unsigned int suffix = input.get_next(); if (!input.end_of_data() ) { unsigned int new_suffix; if ( suffix < table_size + symbols_count ) new_suffix = get_first_symbol(table, suffix, symbols_count); else new_suffix = get_first_symbol(table, prefix, symbols_count); table.push_back( word_type(prefix, new_suffix) ); ++table_size; input.new_code(table_size + symbols_count); decompose( table, prefix, symbols_count, output ); prefix = suffix; } } decompose( table, prefix, symbols_count, output ); } } // lzw_decoder::decode() /*----------------------------------------------------------------------------*/ /** * \brief Get the first symbol of a string, represented by a code. * \param table The table of codes. * \param code The code of the string from which we want the first symbol. * \param symbols_count The count of atomic codes. */ template unsigned int claw::lzw_decoder::get_first_symbol ( const table_type& table, const unsigned int code, const unsigned int symbols_count ) const { unsigned int result = code; while ( result >= symbols_count ) result = table[result - symbols_count].first; return result; } // lzw_decoder::get_first_symbol() /*----------------------------------------------------------------------------*/ /** * \brief Write a string, represented by a code, in the ouput buffer. * \param table The table of codes. * \param code The code of the string to write. * \param symbols_count The count of atomic codes. * \param output Where we write the uncompressed datas. */ template void claw::lzw_decoder::decompose ( const table_type& table, unsigned int code, const unsigned int symbols_count, output_buffer_type& output ) const { std::list result; while ( code >= symbols_count ) { result.push_front( table[code - symbols_count].second ); code = table[code - symbols_count].first; } result.push_front(code); std::list::const_iterator it; for (it=result.begin(); it!=result.end(); ++it) output.write( *it ); } // lzw_decoder::decompose() libclaw-1.7.4/claw/impl/lzw_encoder.tpp000066400000000000000000000025601216507631600201010ustar00rootroot00000000000000/** * \file lzw_encoder.tpp * \brief Implementation of the claw::lzw_encoder class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Encode a sequence of datas. * \param input Where we read the uncompressed data. * \param output Where we write compressed data. */ template void claw::lzw_encoder::encode ( input_buffer_type& input, output_buffer_type& output ) const { typedef std::pair word; if ( !input.end_of_data() ) { std::map table; unsigned int symbol = input.get_next(); unsigned int prefix_code = symbol; unsigned int next_code = input.symbols_count(); while ( !input.end_of_data() && (next_code != output.max_code()) ) { symbol = input.get_next(); word new_word(prefix_code, symbol); if ( table.find(new_word) != table.end() ) prefix_code = table[new_word]; else { output.write(prefix_code); output.new_code(next_code); table[new_word] = next_code; prefix_code = symbol; ++next_code; } } output.write(prefix_code); } } // lzw_encoder::encode() libclaw-1.7.4/claw/impl/max_vector.tpp000066400000000000000000000050751216507631600177410ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file max_vector.tpp * \brief Implementation of the claw::max_vector class. * \author Julien Jorge */ /*---------------------------------------------------------------------------*/ /** * \brief Constructor. */ template claw::max_vector::max_vector() { } // max_vector::max_vector() /*---------------------------------------------------------------------------*/ /** * \brief Constructor with an initial value. * \param e élément ajouté. */ template claw::max_vector::max_vector(const value_type& e) { add(e); } // max_vector::max_vector() /*---------------------------------------------------------------------------*/ /** * \brief Insert a value in the vector. * \param e The value to insert. */ template void claw::max_vector::add(const value_type& e) { if (m_values.empty()) *std::inserter(m_values, m_values.end()) = e; else { comparator_type comp; if ( comp(m_values.front(), e) ) { m_values.clear(); *std::inserter(m_values, m_values.end()) = e; } else if ( !comp(e, m_values.front()) ) *std::inserter(m_values, m_values.end()) = e; } } // max_vector::add() /*---------------------------------------------------------------------------*/ /** * \brief Get the stored values. */ template const typename claw::max_vector::container_type& claw::max_vector::get_v() const { return m_values; } // max_vector::get_v() libclaw-1.7.4/claw/impl/multi_type_map.tpp000066400000000000000000000251321216507631600206160ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file multi_type_map.tpp * \brief Implementation of the claw::multi_type_map class. * \author Julien Jorge */ #include #include namespace claw { /* * Here is the implementation of multi_type_map_wrapper for the case where the * ValueType is the first type in the type list of the map. */ template class multi_type_map_wrapper < Head, multi_type_map > > { typedef Key key_type; typedef Head value_type; typedef multi_type_map > map_type; typedef typename map_type::iterator_type iterator; typedef typename map_type::const_iterator_type const_iterator; public: static void erase( map_type& self, iterator it ) { self.m_data.erase(it); } static std::size_t erase( map_type& self, const key_type& k ) { return self.m_data.erase(k); } static const value_type& get( const map_type& self, const key_type& k ) { CLAW_PRECOND( exists(self, k) ); return self.m_data.find(k)->second; } static value_type& get( map_type& self, const key_type& k ) { CLAW_PRECOND( exists(self, k) ); return self.m_data.find(k)->second; } static void set( map_type& self, const key_type& k, const value_type& v ) { self.m_data[k] = v; } static bool exists( const map_type& self, const key_type& k ) { return self.m_data.find(k) != self.m_data.end(); } static iterator begin( map_type& self ) { return self.m_data.begin(); } static iterator end( map_type& self ) { return self.m_data.end(); } static const_iterator begin( const map_type& self ) { return self.m_data.begin(); } static const_iterator end( const map_type& self ) { return self.m_data.end(); } }; // class multi_type_map_wrapper /* * Here is the implementation of multi_type_map_wrapper for the case where the * ValueType is not the first type in the type list of the map. */ template class multi_type_map_wrapper < ValueType, multi_type_map< Key, meta::type_list > >: public multi_type_map_wrapper< ValueType, multi_type_map > { }; // class multi_type_map_wrapper /* * Here is the implementation of multi_type_map_helper for the case where the * ValueType is the first type in the type list of the map. */ template class multi_type_map_helper < multi_type_map > > { typedef Key key_type; typedef Head value_type; typedef multi_type_map > map_type; typedef typename map_type::iterator_type iterator; typedef typename map_type::const_iterator_type const_iterator; public: static void set( map_type& self, const map_type& that ) { for ( const_iterator it=that.template begin(); it!=that.template end(); ++it ) self.template set( it->first, it->second ); multi_type_map_helper< multi_type_map >::set( self, that ); } // size() static std::size_t size( const map_type& self ) { return self.m_data.size() + multi_type_map_helper< multi_type_map >::size( self ); } // size() }; // class multi_type_map_helper /* * Here is the implementation of multi_type_map_helper that stops the * recursivity. */ template class multi_type_map_helper < multi_type_map< Key, claw::meta::no_type > > { private: typedef multi_type_map map_type; public: static void set( map_type& self, const map_type& that ) { // nothing to do } // set() static std::size_t size( const map_type& self ) { return 0; } // size() }; // class multi_type_map_helper } // namespace claw /*----------------------------------------------------------------------------*/ /** * \brief Erase a value from the map. * \param k The key of the value to erase. * \return The number of removed elements (zero or one). */ template template void claw::multi_type_map< Key, claw::meta::type_list >::erase ( typename iterator::type it ) { multi_type_map_wrapper::erase(*this, it); } // multi_type_map::erase() /*----------------------------------------------------------------------------*/ /** * \brief Erase a value from the map. * \param k The key of the value to erase. * \return The number of removed elements (zero or one). */ template template std::size_t claw::multi_type_map< Key, claw::meta::type_list >::erase ( const key_type& k ) { return multi_type_map_wrapper::erase(*this, k); } // multi_type_map::erase() /*----------------------------------------------------------------------------*/ /** * \brief Get a value from the map. * \param k The key of the value to get. */ template template const ValueType& claw::multi_type_map< Key, claw::meta::type_list >::get ( const key_type& k ) const { return multi_type_map_wrapper::get(*this, k); } // multi_type_map::get() /*----------------------------------------------------------------------------*/ /** * \brief Get a value from the map. * \param k The key of the value to get. */ template template ValueType& claw::multi_type_map< Key, claw::meta::type_list >::get ( const key_type& k ) { return multi_type_map_wrapper::get(*this, k); } // multi_type_map::get() /*----------------------------------------------------------------------------*/ /** * \brief Set a value in the map. * \param k The key of the value to set. * \param v The value to set. */ template template void claw::multi_type_map< Key, claw::meta::type_list >::set ( const key_type& k, const ValueType& v ) { return multi_type_map_wrapper::set(*this, k, v); } // multi_type_map::set() /*----------------------------------------------------------------------------*/ /** * \brief Set a value in the map. * \param k The key of the value to set. * \param v The value to set. */ template void claw::multi_type_map< Key, claw::meta::type_list >::set ( const self_type& m ) { multi_type_map_helper::set(*this, m); } // multi_type_map::set() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the map contains a value of a given type with a given key. * \param k The key of the value to get. */ template template bool claw::multi_type_map< Key, claw::meta::type_list >::exists ( const key_type& k ) const { return multi_type_map_wrapper::exists(*this, k); } // multi_type_map::exists() /*----------------------------------------------------------------------------*/ /** * \brief Return the number of elements in the map. */ template std::size_t claw::multi_type_map< Key, claw::meta::type_list >::size() const { return multi_type_map_helper::size(*this); } // multi_type_map::size() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the beginning of the map for a given type. */ template template typename claw::multi_type_map < Key, claw::meta::type_list >::template iterator::type claw::multi_type_map< Key, claw::meta::type_list >::begin() { return multi_type_map_wrapper::begin(*this); } // multi_type_map::begin() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the end of the map for a given type. */ template template typename claw::multi_type_map < Key, claw::meta::type_list >::template iterator::type claw::multi_type_map< Key, claw::meta::type_list >::end() { return multi_type_map_wrapper::end(*this); } // multi_type_map::end() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the beginning of the map for a given type. */ template template typename claw::multi_type_map < Key, claw::meta::type_list > ::template iterator::const_type claw::multi_type_map< Key, claw::meta::type_list >::begin() const { return multi_type_map_wrapper::begin(*this); } // multi_type_map::begin() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the end of the map for a given type. */ template template typename claw::multi_type_map < Key, claw::meta::type_list > ::template iterator::const_type claw::multi_type_map< Key, claw::meta::type_list >::end() const { return multi_type_map_wrapper::end(*this); } // multi_type_map::end() libclaw-1.7.4/claw/impl/multi_type_map_visitor.tpp000066400000000000000000000074471216507631600224060ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file multi_type_map_visitor.tpp * \brief Implementation of the claw::multi_type_map_visitor class. * \author Julien Jorge */ namespace claw { /** * \brief This class goes through all entries of a given type in a * multi_type_map and apply a function to them. * \author Julien Jorge */ template class multi_type_map_visitor_process { public: template void execute ( multi_type_map< Key, claw::meta::type_list >& m, Function f ) { typedef claw::meta::type_list type_list_type; typedef multi_type_map map_type; typedef typename map_type::template iterator::type iterator_type; iterator_type it( m.template begin() ); const iterator_type eit( m.template end() ); while ( it!=eit ) { iterator_type current(it); ++it; f(current->first, current->second); } } // execute() }; // class multi_type_map_visitor_process /** * \brief This class goes through all entries in a multi_type_map and apply a * function to them. * \author Julien Jorge */ template class multi_type_map_visitor_rec; /** * \brief Specialization of multi_type_map_visitor_rec for an empty type list. * \author Julien Jorge */ template class multi_type_map_visitor_rec { public: template void execute( multi_type_map& vars, Function f ) { // nothing to do. } // execute() }; // class multi_type_map_visitor /** * \brief Specialization of multi_type_map_visitor_rec for a non empty type * list. * \author Julien Jorge */ template class multi_type_map_visitor_rec < KeyType, claw::meta::type_list > { public: template void execute ( multi_type_map< KeyType, claw::meta::type_list >& m, Function f ) { multi_type_map_visitor_process process; multi_type_map_visitor_rec rec_call; process.execute( m, f ); rec_call.execute( m, f ); } // execute() }; // class multi_type_map_visitor_rec } // namespce claw /*----------------------------------------------------------------------------*/ /** * \brief Execute the visitor. * \param m The map to visit. * \param f The function to apply to the entries. */ template void claw::multi_type_map_visitor::run ( multi_type_map& m, Function f ) const { multi_type_map_visitor_rec rec_call; rec_call.execute( m, f ); } // multi_type_map_visitor::run() libclaw-1.7.4/claw/impl/ordered_set.tpp000066400000000000000000000171171216507631600200710ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file ordered_set.tpp * \brief Implementation of the claw::math::ordered_set * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ template Comp claw::math::ordered_set::s_key_comp; /*----------------------------------------------------------------------------*/ /** * \brief Intersection. * \param that The instance to intersect from. */ template claw::math::ordered_set& claw::math::ordered_set::operator*=( const ordered_set& that ) { return intersection( that ); } // ordered_set::operator*=() /*----------------------------------------------------------------------------*/ /** * \brief Union. * \param that The instance to join with. */ template claw::math::ordered_set& claw::math::ordered_set::operator+=( const ordered_set& that ) { return join( that ); } // ordered_set::operator+=() /*----------------------------------------------------------------------------*/ /** * \brief Difference. * \param that The instance from which to remove items. */ template claw::math::ordered_set& claw::math::ordered_set::operator-=( const ordered_set& that ) { return difference( that ); } // ordered_set::operator-=() /*----------------------------------------------------------------------------*/ /** * \brief Symetric difference. * \param that The instance to differ from. */ template claw::math::ordered_set& claw::math::ordered_set::operator/=( const ordered_set& that ) { return symetric_difference( that ); } // ordered_set::operator/=() /*----------------------------------------------------------------------------*/ /** * \brief Inclusion. * \param that The instance that should be contained. * \return true if that is strictly included in this. */ template bool claw::math::ordered_set::operator>( const ordered_set& that ) const { return strictly_contains( that ); } // ordered_set::operator>() /*----------------------------------------------------------------------------*/ /** * \brief Inclusion or equality. * \param that The instance that should be contained. * \return true if that is included in this. */ template bool claw::math::ordered_set::operator>=( const ordered_set& that ) const { return contains( that ); } // ordered_set::operator>=() /*----------------------------------------------------------------------------*/ /** * \brief Inclusion. * \param that The instance that should contain. * \return true if that is strictly included in this. */ template bool claw::math::ordered_set::operator<( const ordered_set& that ) const { return that.strictly_contains( *this ); } // ordered_set::operator<() /*----------------------------------------------------------------------------*/ /** * \brief Inclusion or equality. * \param that The instance that should be contained. * \return true if that is included in this. */ template bool claw::math::ordered_set::operator<=( const ordered_set& that ) const { return that.contains( *this ); } // ordered_set::operator<=() /*----------------------------------------------------------------------------*/ /** * \brief Intersection. * \param that The instance to intersect from. */ template claw::math::ordered_set& claw::math::ordered_set::intersection( const ordered_set& that ) { std::list remove_us; const_iterator it; for (it=super::begin(); it!=super::end(); ++it) if ( that.find( *it ) == that.end() ) remove_us.push_front( *it ); typename std::list::const_iterator remove_it; for (remove_it=remove_us.begin(); remove_it!=remove_us.end(); ++remove_it) super::erase( *remove_it ); return *this; } // ordered_set::intersection() /*----------------------------------------------------------------------------*/ /** * \brief Union. * \param that The instance to join with. */ template claw::math::ordered_set& claw::math::ordered_set::join( const ordered_set& that ) { const_iterator it; for (it=that.begin(); it!=that.end(); ++it) super::insert( *it ); return *this; } // ordered_set::join() /*----------------------------------------------------------------------------*/ /** * \brief Difference. * \param that The instance from which to remove items. */ template claw::math::ordered_set& claw::math::ordered_set::difference( const ordered_set& that ) { std::list remove_us; const_iterator it; for (it=super::begin(); it!=super::end(); ++it) if ( that.find( *it ) != that.end() ) remove_us.push_front( *it ); typename std::list::const_iterator remove_it; for (remove_it=remove_us.begin(); remove_it!=remove_us.end(); ++remove_it) super::erase( *remove_it ); return *this; } // ordered_set::difference() /*----------------------------------------------------------------------------*/ /** * \brief Symetric difference. * \param that The instance to differ from. */ template claw::math::ordered_set& claw::math::ordered_set::symetric_difference( const ordered_set& that ) { ordered_set my_copy(*this), his_copy(that); return difference( that ).join( his_copy.difference(my_copy) ); } // ordered_set::symetric_difference() /*----------------------------------------------------------------------------*/ /** * \brief Inclusion or equality. * \param that The instance that should be contained. * \return true if that is included in this. */ template bool claw::math::ordered_set::contains( const ordered_set& that ) const { bool ok = super::size() >= that.size(); const_iterator it_this( super::begin() ); const_iterator it_that( that.begin() ); while ( ok && (it_that != that.end()) && (it_this != super::end()) ) if ( s_key_comp( *it_this, *it_that ) ) ++it_this; else if ( s_key_comp( *it_that, *it_this ) ) ok = false; else { ++it_this; ++it_that; } return it_that == that.end(); } // ordered_set::contains() /*----------------------------------------------------------------------------*/ /** * \brief Inclusion. * \param that The instance that should contain. * \return true if that is strictly included in this. */ template bool claw::math::ordered_set::strictly_contains ( const ordered_set& that ) const { return contains(that) && ( super::size() > that.size() ); } // ordered_set::strictly_contains() libclaw-1.7.4/claw/impl/osocket_stream.tpp000066400000000000000000000101171216507631600206050ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file osocket_stream.tpp * \brief Implementation of the claw::net::basic_osocket_stream class. * \author Julien Jorge */ /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ template claw::net::basic_osocket_stream::basic_osocket_stream() : super(&m_buffer) { } // basic_osocket_stream::basic_osocket_stream() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param address The address to which we will connect. * \param port The port number to use for the connection. */ template claw::net::basic_osocket_stream::basic_osocket_stream ( const std::string& address, int port ) : super(&m_buffer) { open(address, port); } // basic_osocket_stream::basic_osocket_stream() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ template claw::net::basic_osocket_stream::~basic_osocket_stream() { // nothing to do } // basic_osocket_stream::~basic_osocket_stream() /*----------------------------------------------------------------------------*/ /** * \brief Get the output buffer. */ template typename claw::net::basic_osocket_stream::buffer_type* claw::net::basic_osocket_stream::rdbuf() const { return const_cast(&m_buffer); } // basic_osocket_stream::rdbuf() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the stream is open. */ template bool claw::net::basic_osocket_stream::is_open() const { return m_buffer.is_open(); } // basic_osocket_stream::() /*----------------------------------------------------------------------------*/ /** * \brief Connect the socket to an address. * \param address The address to which we will connect. * \param port The port number to use for the connection. */ template void claw::net::basic_osocket_stream::open ( const std::string& address, int port ) { if ( !m_buffer.open(address, port) ) this->setstate(std::ios_base::failbit); else this->clear(); } // basic_osocket_stream::open() /*----------------------------------------------------------------------------*/ /** * \brief Link the socket to a file descriptor. * \param fd The file descriptor. * \remark This method should be only called by claw::net::socket_server. */ template void claw::net::basic_osocket_stream::open( int fd ) { if ( !m_buffer.open(fd) ) this->setstate(std::ios_base::failbit); else this->clear(); } // basic_osocket_stream::open() /*----------------------------------------------------------------------------*/ /** * \brief Close the connection. */ template void claw::net::basic_osocket_stream::close() { if ( !m_buffer.close() ) this->setstate(std::ios_base::failbit); } // basic_osocket_stream::close() libclaw-1.7.4/claw/impl/pcx_reader.tpp000066400000000000000000000035201216507631600176770ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file pcx_reader.tpp * \brief Implementation of the template methods of the pcx::reader class. * \author Julien Jorge */ /*----------------------------------------------------------------------------*/ /** * \brief Decompress the scan lines and convert their contents into pixels in * the image. * \param h The header read in the file. * \param f The file from which we read. * \param convert Converter to use to convert the data into pixels. */ template void claw::graphic::pcx::reader::decompress ( const header& h, std::istream& f, const Converter& convert ) { std::vector scanline ( h.color_planes, color_plane_type(h.bytes_per_line) ); for ( unsigned int y=0; y!=m_image.height(); ++y) { for (unsigned int i=0; i!=h.color_planes; ++i) decompress_line(f, scanline[i]); convert( scanline, m_image, y ); } } // pcx::reader::decompress() libclaw-1.7.4/claw/impl/pcx_writer.tpp000066400000000000000000000030061216507631600177500ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file pcx_writer.tpp * \brief Implementation of the template methods of the pcx::writer class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Write raw data int the stream. * \param first Iterator on the first data. * \param last Iterator past the last data. */ template void claw::graphic::pcx::writer::file_output_buffer::raw ( Iterator first, Iterator last ) { CLAW_ASSERT( false, "This method should not have been called" ); } // pcx::writer::file_output_buffer::raw() libclaw-1.7.4/claw/impl/real_number.tpp000066400000000000000000000244741216507631600200710ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/impl/real_number.tpp * \brief Implementation of the claw::real_number class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Constructuor. */ template claw::real_number::real_number() : m_value(0), m_epsilon( make_epsilon::value(m_value) ) { } // real_number::real_number() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param v The value of the number. */ template claw::real_number::real_number( const value_type& v ) : m_value(v), m_epsilon( make_epsilon::value(m_value) ) { } // real_number::real_number() /*----------------------------------------------------------------------------*/ /** * \brief Copy constructor. * \param that The instance to copy from. */ template claw::real_number::real_number( const self_type& that ) : m_value(that.m_value), m_epsilon(that.m_epsilon) { } // real_number::real_number() /*----------------------------------------------------------------------------*/ /** * \brief Get the absolute value of the number. */ template typename claw::real_number::self_type claw::real_number::abs() const { return self_type( std::abs(m_value) ); } // real_number::abs() /*----------------------------------------------------------------------------*/ /** * \brief Tell if this number is stricty lower than an other number. * \param that The other number. */ template bool claw::real_number::operator<( const self_type& that ) const { if ( that.m_value == std::numeric_limits::infinity() ) return m_value != std::numeric_limits::infinity(); else if ( that.m_value == -std::numeric_limits::infinity() ) return false; else if ( m_value == std::numeric_limits::infinity() ) return false; else if ( m_value == -std::numeric_limits::infinity() ) return that.m_value != -std::numeric_limits::infinity(); else return m_value < (that.m_value - std::max(m_epsilon, that.m_epsilon)); } // real_number::operator<() /*----------------------------------------------------------------------------*/ /** * \brief Tell if this number is lower or equal to an other number. * \param that The other number. */ template bool claw::real_number::operator<=( const self_type& that ) const { return !(that < *this); } // real_number::operator<=() /*----------------------------------------------------------------------------*/ /** * \brief Tell if this number is stricty greater than an other number. * \param that The other number. */ template bool claw::real_number::operator>( const self_type& that ) const { return that < *this; } // real_number::operator>() /*----------------------------------------------------------------------------*/ /** * \brief Tell if this number is greater or equal to an other number. * \param that The other number. */ template bool claw::real_number::operator>=( const self_type& that ) const { return that <= *this; } // real_number::operator>=() /*----------------------------------------------------------------------------*/ /** * \brief Tell if this number is equal to an other number. * \param that The other number. */ template bool claw::real_number::operator==( const self_type& that ) const { if ( that.m_value == std::numeric_limits::infinity() ) return m_value == std::numeric_limits::infinity(); else if ( that.m_value == -std::numeric_limits::infinity() ) return m_value == -std::numeric_limits::infinity(); else if ( m_value == that.m_value ) return true; else return std::abs(m_value - that.m_value) <= std::max(m_epsilon, that.m_epsilon); } // real_number::operator==() /*----------------------------------------------------------------------------*/ /** * \brief Tell if this number is not equal to an other number. * \param that The other number. */ template bool claw::real_number::operator!=( const self_type& that ) const { return !((*this) == that); } // real_number::operator!=() /*----------------------------------------------------------------------------*/ /** * \brief Sum two numbers. * \param that The other number. */ template typename claw::real_number::self_type claw::real_number::operator+( const self_type& that ) const { return self_type(m_value + that.m_value); } // real_number::operator+() /*----------------------------------------------------------------------------*/ /** * \brief Get the difference of two numbers. * \param that The other number. */ template typename claw::real_number::self_type claw::real_number::operator-( const self_type& that ) const { return self_type(m_value - that.m_value); } // real_number::operator-() /*----------------------------------------------------------------------------*/ /** * \brief Multiply two numbers. * \param that The other number. */ template typename claw::real_number::self_type claw::real_number::operator*( const self_type& that ) const { return self_type(m_value * that.m_value); } // real_number::operator*() /*----------------------------------------------------------------------------*/ /** * \brief Divide by an other number. * \param that The other number. */ template typename claw::real_number::self_type claw::real_number::operator/( const self_type& that ) const { return self_type(m_value / that.m_value); } // real_number::operator/() /*----------------------------------------------------------------------------*/ /** * \brief Add an other number. * \param that The other number. */ template typename claw::real_number::self_type& claw::real_number::operator+=( const self_type& that ) { m_value += that.m_value; m_epsilon = make_epsilon::value(m_value); return *this; } // real_number::operator+=() /*----------------------------------------------------------------------------*/ /** * \brief Subtract an other number. * \param that The other number. */ template typename claw::real_number::self_type& claw::real_number::operator-=( const self_type& that ) { m_value -= that.m_value; m_epsilon = make_epsilon::value(m_value); return *this; } // real_number::operator-=() /*----------------------------------------------------------------------------*/ /** * \brief Multiply by an other number. * \param that The other number. */ template typename claw::real_number::self_type& claw::real_number::operator*=( const self_type& that ) { m_value *= that.m_value; m_epsilon = make_epsilon::value(m_value); return *this; } // real_number::operator*=() /*----------------------------------------------------------------------------*/ /** * \brief Divide by an other number. * \param that The other number. */ template typename claw::real_number::self_type& claw::real_number::operator/=( const self_type& that ) { m_value /= that.m_value; m_epsilon = make_epsilon::value(m_value); return *this; } // real_number::operator/=() /*----------------------------------------------------------------------------*/ /** * \brief Output the value in a stream. * \param os The stream in which the value is written. */ template std::ostream& claw::real_number::output( std::ostream& os ) const { return os << m_value; } // real_number::output() /*----------------------------------------------------------------------------*/ /** * \brief Cast the value. */ template template claw::real_number::operator U() const { return (U)m_value; } // real_number::operator U() /*----------------------------------------------------------------------------*/ /** * \brief Get the absolute value of a number. * \param v The number. */ template claw::real_number std::abs( const claw::real_number& v ) { return v.abs(); } // abs() /*----------------------------------------------------------------------------*/ /** * \brief Get the opposite value of a number. * \param self The number. */ template claw::real_number operator-( const claw::real_number& self ) { return claw::real_number(0) - self; } // operator-() /*----------------------------------------------------------------------------*/ /** * \brief Subtract a number to an other value. * \param v The other value. * \param self The number. */ template claw::real_number operator-( T v, const claw::real_number& self ) { return claw::real_number(v) - self; } // operator-() /*----------------------------------------------------------------------------*/ /** * \brief Output a number in a stream. * \param os The stream in which the value is written. * \param self The number. */ template std::ostream& operator<<( std::ostream& os, const claw::real_number& self ) { return self.output(os); } // operator<<() /*----------------------------------------------------------------------------*/ /** * \brief Read a number from a stream. * \param is The stream from which the value is read. * \param self The number. */ template std::istream& operator>>( std::istream& is, claw::real_number& self ) { return is >> self.m_value; } // operator>>() libclaw-1.7.4/claw/impl/rectangle.tpp000066400000000000000000000261761216507631600175430ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file rectangle.tpp * \brief Implementation of claw::math::rectangle class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ template claw::math::rectangle::rectangle() { } // rectangle::rectangle() [constructor] /*----------------------------------------------------------------------------*/ /** * \brief Copy constructor. * \param that Rectangle to copy from. */ template template claw::math::rectangle::rectangle( const rectangle& that ) : position(that.position), width(that.width), height(that.height) { } // rectangle::rectangle() [copy constructor] /*----------------------------------------------------------------------------*/ /** * \brief Constructor from a box. * \param that The box to copy from. */ template template claw::math::rectangle::rectangle( const box_2d& that ) : position(that.left(), that.top()), width(that.width()), height(that.height()) { } // rectangle::rectangle() [copy constructor] /*----------------------------------------------------------------------------*/ /** * \brief Constructor with initialization. * \param _x Rectangle's X-coordinate. * \param _y Rectangle's Y-coordinate. * \param _width Rectangle's width. * \param _height Rectangle's height. */ template claw::math::rectangle::rectangle ( const value_type& _x, const value_type& _y, const value_type& _width, const value_type& _height ) : position(_x, _y), width(_width), height(_height) { } // rectangle::rectangle() [constructor with values] /*----------------------------------------------------------------------------*/ /** * \brief Constructor with initialization. * \param pos The position of the rectangle. * \param _width Rectangle's width. * \param _height Rectangle's height. */ template template claw::math::rectangle::rectangle ( const coordinate_2d& pos, const value_type& _width, const value_type& _height ) : position(pos), width(_width), height(_height) { } // rectangle::rectangle() [constructor from position and size] /*----------------------------------------------------------------------------*/ /** * \brief Constructor with initialization. * \param pos The position of the rectangle. * \param size The size of the rectangle. */ template template claw::math::rectangle::rectangle ( const coordinate_2d& pos, const coordinate_2d& size ) : position(pos), width(size.x), height(size.y) { } // rectangle::rectangle() [constructor from position and size] /*----------------------------------------------------------------------------*/ /** * \brief Get a copy of the rectangle by converting its members to a given type. * * Consider the following code: * * rectangle a; * * ... * * rectangle b(a); * * The copy constructor will be called, and your compiler should print some * warnings in your console. These warnings have a meaning, so we don't want to * make them disapear by adding explicit type conversion inside the rectangle * class nor adding a cast operator that will be used silently by the compiler. * * If you really want to convert the type, this method will explicitly cast the * member variables. */ template template claw::math::rectangle claw::math::rectangle::cast_value_type_to() const { return claw::math::rectangle ( position.cast_value_type_to(), (U)width, (U)height ); } // rectangle::cast_value_type_to() /*----------------------------------------------------------------------------*/ /** * \brief Tell if this rectangle equals an other rectangle. * \param that The rectangle to compare to. */ template bool claw::math::rectangle::operator==( const self_type& that ) const { return (position == that.position) && (width == that.width) && (height == that.height); } // rectangle::operator==() /*----------------------------------------------------------------------------*/ /** * \brief Tell if this rectangle equals an other rectangle. * \param that The rectangle to compare to. */ template bool claw::math::rectangle::operator!=( const self_type& that ) const { return !(*this == that); } // rectangle::operator!=() /*----------------------------------------------------------------------------*/ /** * \brief Calculate the rectangle's area. */ template typename claw::math::rectangle::value_type claw::math::rectangle::area() const { return width * height; } // rectangle::area() /*----------------------------------------------------------------------------*/ /** * \brief Tell if a point is in a rectangle. * \param p The supposed included point. */ template bool claw::math::rectangle::includes( const coordinate_2d& p ) const { return (position.x <= p.x) && (right() >= p.x) && (position.y <= p.y) && (bottom() >= p.y); } // rectangle::includes() /*----------------------------------------------------------------------------*/ /** * \brief Tell if a rectangle is in a rectangle. * \param r The supposed included rectangle. */ template bool claw::math::rectangle::includes( const self_type& r ) const { box_2d his_box(r); return includes(his_box.first_point) && includes(his_box.second_point); } // rectangle::includes() [rectangle] /*----------------------------------------------------------------------------*/ /** * \brief Tell if there is an intersection of two rectangles. * \param r The supposed intersecting rectangle. */ template bool claw::math::rectangle::intersects( const self_type& r ) const { return (right() >= r.position.x) && (r.right() >= position.x) && (bottom() >= r.position.y) && (r.bottom() >= position.y); } // rectangle::intersects() /*----------------------------------------------------------------------------*/ /** * \brief Intersection of two rectangles. * \param r The supposed intersecting rectangle. */ template claw::math::rectangle claw::math::rectangle::intersection( const self_type& r ) const { self_type result; if ( intersects(r) ) { x_intersection(r, result); y_intersection(r, result); } return result; } // rectangle::intersection() /*----------------------------------------------------------------------------*/ /** * \brief Get the smallest rectangle bounding both this rectangle and another * one. * \param r The other rectangle. */ template claw::math::rectangle claw::math::rectangle::join( const self_type& r ) const { const T result_left = std::min( left(), r.left() ); const T result_top = std::min( top(), r.top() ); const T result_bottom = std::max( bottom(), r.bottom() ); const T result_right = std::max( right(), r.right() ); return self_type ( result_left, result_top, result_right - result_left, result_bottom - result_top ); } // rectangle::join() /*----------------------------------------------------------------------------*/ /** * \brief set new position and size to the rectangle. * \param new_x New x-coordinate. * \param new_y New y-coordinate. * \param new_width New width. * \param new_height New height. */ template void claw::math::rectangle::set ( const value_type& new_x, const value_type& new_y, const value_type& new_width, const value_type& new_height ) { position.x = new_x; position.y = new_y; width = new_width; height = new_height; } // rectangle::set() /*----------------------------------------------------------------------------*/ /** * \brief Get the x-coordinate of the left edge. */ template typename claw::math::rectangle::value_type claw::math::rectangle::left() const { return position.x; } // rectangle::left() /*----------------------------------------------------------------------------*/ /** * \brief Get the x-coordinate of the right edge. */ template typename claw::math::rectangle::value_type claw::math::rectangle::right() const { return position.x + width; } // rectangle::right() /*----------------------------------------------------------------------------*/ /** * \brief Get the y-coordinate of the bottom edge. */ template typename claw::math::rectangle::value_type claw::math::rectangle::bottom() const { return position.y + height; } // rectangle::bottom() /*----------------------------------------------------------------------------*/ /** * \brief Get the y-coordinate of the top edge. */ template typename claw::math::rectangle::value_type claw::math::rectangle::top() const { return position.y; } // rectangle::top() /*----------------------------------------------------------------------------*/ /** * \brief Get the size of the rectangle. */ template claw::math::coordinate_2d< typename claw::math::rectangle::value_type > claw::math::rectangle::size() const { return claw::math::coordinate_2d(width, height); } // rectangle::size() /*----------------------------------------------------------------------------*/ /** * \brief X-intersection of two rectangles. * \pre There is an intersection between this and r. * \post result's x and width fields are filled. */ template void claw::math::rectangle::x_intersection ( const self_type& r, self_type& result ) const { if (position.x <= r.position.x) { result.position.x = r.position.x; if (right() >= r.right()) result.width = r.width; else result.width = right() - r.position.x; } else r.x_intersection(*this, result); } // rectangle::x_intersection() /*----------------------------------------------------------------------------*/ /** * \brief Y-intersection of two rectangles. * \pre There is an intersection between this and r. * \post result's y and height fields are filled. */ template void claw::math::rectangle::y_intersection ( const self_type& r, self_type& result ) const { if (position.y <= r.position.y) { result.position.y = r.position.y; if (bottom() >= r.bottom()) result.height = r.height; else result.height = bottom() - r.position.y; } else r.y_intersection(*this, result); } // rectangle::y_intersection() libclaw-1.7.4/claw/impl/rle_decoder.tpp000066400000000000000000000044431216507631600200370ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file rle_decoder.tpp * \brief Implementation of the claw::rle_decoder class and subclasses. * \author Julien Jorge */ /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ template< typename Pattern, typename InputBuffer, typename OutputBuffer > claw::rle_decoder::rle_decoder() : m_mode(stop), m_count(0) { } // rle_decoder::rle_decoder() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ template< typename Pattern, typename InputBuffer, typename OutputBuffer > claw::rle_decoder::~rle_decoder() { } // rle_decoder::~rle_decoder() /*----------------------------------------------------------------------------*/ /** * \brief Decode a RLE stream. * \param input The RLE stream. * \param output The raw stream. */ template< typename Pattern, typename InputBuffer, typename OutputBuffer > void claw::rle_decoder::decode ( input_buffer_type& input, output_buffer_type& output ) { m_mode = stop; read_mode(input, output); while( m_mode != stop ) { if ( m_mode == compressed ) output.fill( m_count, m_pattern ); else output.copy( m_count, input ); read_mode(input, output); } } // rle_decoder::decode() libclaw-1.7.4/claw/impl/rle_encoder.tpp000066400000000000000000000052371216507631600200530ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file rle_encoder.tpp * \brief Implementation of the rle_encoder class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Encode a range of datas. * \param first Iterator on the first data. * \param last Iterator past the last data. * \param output The buffer on which we write the compressed data. * * \pre Iterator::value_type must be castable to pattern_type. */ template template void claw::rle_encoder::encode( Iterator first, Iterator last, output_buffer_type& output ) const { const unsigned int max_encodable = output.max_encodable(); const unsigned int min_interesting = output.min_interesting(); raw_buffer_type raw_buffer; assert( max_encodable > 0 ); while (first != last) { unsigned int count = 1; pattern_type pattern = *first; Iterator saved_it = first; ++first; bool ok = true; // try to find enough similar data while ( ok && (first != last) && (count < max_encodable) ) if (*first == pattern) { ++count; ++first; } else ok = false; // if we have enough data if ( count >= min_interesting ) { if ( !raw_buffer.empty() ) { output.raw( raw_buffer.begin(), raw_buffer.end() ); raw_buffer.clear(); } output.encode( count, pattern ); } else raw_buffer.insert( raw_buffer.end(), saved_it, first ); } if ( !raw_buffer.empty() ) output.raw( raw_buffer.begin(), raw_buffer.end() ); } // rle_encoder::encode() libclaw-1.7.4/claw/impl/smart_ptr.tpp000066400000000000000000000157041216507631600176050ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file smart_ptr.tpp * \brief Implementation of the claw::memory::smart_ptr class. * \author Julien Jorge */ #include #include /*----------------------------------------------------------------------------*/ /** * \brief Default constructor. */ template claw::memory::smart_ptr::smart_ptr() : m_ref_count(NULL), m_ptr(NULL) { } // smart_ptr::smart_ptr() /*----------------------------------------------------------------------------*/ /** * \brief Constructor from a pointer. * \param data Pointer on the data. * * \b Warning: this constructor allows expressions like * * int a; smart_ptr p(&a); * * Nevertheless, you should never fo that. */ template claw::memory::smart_ptr::smart_ptr( pointer data ) : m_ref_count(NULL), m_ptr(NULL) { if (data) { m_ref_count = new unsigned int(1); m_ptr = data; } } // smart_ptr::smart_ptr() [pointer] /*----------------------------------------------------------------------------*/ /** * \brief Copy constructor. * \param that The smart_pointer to copy. */ template claw::memory::smart_ptr::smart_ptr( const self_type& that ) { copy( that ); } // smart_ptr::smart_ptr() [copy] /*----------------------------------------------------------------------------*/ /** * \brief Destructor. The memory is freed only if no more smart_ptr point on it. */ template claw::memory::smart_ptr::~smart_ptr() { release(); } // smart_ptr::~smart_ptr() /*----------------------------------------------------------------------------*/ /** * \brief Assignment operator. * \param that The smart_ptr to copy. */ template typename claw::memory::smart_ptr::self_type& claw::memory::smart_ptr::operator=( const self_type& that ) { if ( &that != this ) { release(); copy( that ); } return *this; } // smart_ptr::operator=() /*----------------------------------------------------------------------------*/ /** * \brief Equality operator. * \param that The pointer to compare to. * \return !(*this < that) && !(that < *this). */ template bool claw::memory::smart_ptr::operator==( const self_type& that ) const { return !(*this < that) && !(that < *this); } // smart_ptr::operator==() /*----------------------------------------------------------------------------*/ /** * \brief Disequality operator. * \param that The pointer to compare to. * \return (*this < that) || (that < *this). */ template bool claw::memory::smart_ptr::operator!=( const self_type& that ) const { return (*this < that) || (that < *this); } // smart_ptr::operator!=() /*----------------------------------------------------------------------------*/ /** * \brief "Less than" operator. * \param that The pointer to compare to. * \return True if the address pointed by \a this is lower than the address * pointed by \a that. */ template bool claw::memory::smart_ptr::operator<( const self_type& that ) const { return m_ptr < that.m_ptr; } // smart_ptr::operator<() /*----------------------------------------------------------------------------*/ /** * \brief "Less or equal" operator. * \param that The pointer to compare to. * \return !(that < *this). */ template bool claw::memory::smart_ptr::operator<=( const self_type& that ) const { return !(that < *this); } // smart_ptr::operator<=() /*----------------------------------------------------------------------------*/ /** * \brief "Greater than" operator. * \param that The pointer to compare to. * \return \a that < *this. */ template bool claw::memory::smart_ptr::operator>( const self_type& that ) const { return that < *this; } // smart_ptr::operator>() /*----------------------------------------------------------------------------*/ /** * \brief "Greater or equal" operator. * \param that The pointer to compare to. * \return !(*this < that). */ template bool claw::memory::smart_ptr::operator>=( const self_type& that ) const { return !(*this < that); } // smart_ptr::operator>=() /*----------------------------------------------------------------------------*/ /** * \brief Dereference operator. */ template typename claw::memory::smart_ptr::pointer claw::memory::smart_ptr::operator->() { return m_ptr; } // smart_ptr::operator->() /*----------------------------------------------------------------------------*/ /** * \brief Dereference operator. */ template typename claw::memory::smart_ptr::pointer claw::memory::smart_ptr::operator->() const { return m_ptr; } // smart_ptr::operator->() /*----------------------------------------------------------------------------*/ /** * \brief Dereference operator. */ template typename claw::memory::smart_ptr::reference claw::memory::smart_ptr::operator*() { return *m_ptr; } // smart_ptr::operator*() /*----------------------------------------------------------------------------*/ /** * \brief Dereference operator. */ template typename claw::memory::smart_ptr::reference claw::memory::smart_ptr::operator*() const { return *m_ptr; } // smart_ptr::operator*() /*----------------------------------------------------------------------------*/ /** * \brief Copy a smart_ptr. * \param that The smart_pointer to copy. */ template void claw::memory::smart_ptr::copy( const self_type& that ) { assert( this != &that ); m_ref_count = that.m_ref_count; m_ptr = that.m_ptr; if (m_ref_count) ++(*m_ref_count); } // smart_ptr::copy() /*----------------------------------------------------------------------------*/ /** * \brief Release the allocated memory. * * The memory is release only if no more smart_ptr point on it. */ template void claw::memory::smart_ptr::release() { if (m_ref_count) if ( *m_ref_count ) { --(*m_ref_count); if ( !(*m_ref_count) ) { delete m_ptr; delete m_ref_count; m_ref_count = NULL; } m_ptr = NULL; } } // smart_ptr::release() libclaw-1.7.4/claw/impl/socket_server.tpp000066400000000000000000000033051216507631600204420ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file socket_server.tpp * \brief Implantation of the template methods of the claw::net::socket_server * class. * \author Julien Jorge */ /*----------------------------------------------------------------------------*/ /** * \brief Accept an incoming connection. * \param sock (out) The socket created for this connection. * \param time_limit Maximum of seconds to wait before considering there won't * be any connection. if \a time_limit is negative, the server wait until * there is a connection. */ template void claw::net::socket_server::accept( SocketStream& sock, int time_limit ) { if ( socket_traits::select_read( m_descriptor, time_limit ) ) sock.open( socket_traits::accept( m_descriptor ) ); } // socket_server::accept() libclaw-1.7.4/claw/impl/socket_stream.tpp000066400000000000000000000116151216507631600204320ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file socket_stream.tpp * \brief Implementation of the claw::net::basic_socket_stream class. * \author Julien Jorge */ /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param read_delay Number of second to wait before considering nothing will * come in the socket. Negative values mean infinity. */ template claw::net::basic_socket_stream::basic_socket_stream ( int read_delay ) : m_buffer(read_delay) { this->init(&m_buffer); } // basic_socket_stream::basic_socket_stream() /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param address The address to which we will connect. * \param port The port number to use for the connection. * \param read_delay Number of second to wait before considering nothing will * come in the socket. Negative values mean infinity. */ template claw::net::basic_socket_stream::basic_socket_stream ( const char* address, int port, int read_delay ) : m_buffer(read_delay) { this->init(&m_buffer); open(address, port); } // basic_socket_stream::basic_socket_stream() /*----------------------------------------------------------------------------*/ /** * \brief Destructor. */ template claw::net::basic_socket_stream::~basic_socket_stream() { // nothing to do } // basic_socket_stream::~basic_socket_stream() /*----------------------------------------------------------------------------*/ /** * \brief Get the buffer. */ template typename claw::net::basic_socket_stream::buffer_type* claw::net::basic_socket_stream::rdbuf() const { return const_cast(&m_buffer); } // basic_socket_stream::rdbuf() /*----------------------------------------------------------------------------*/ /** * \brief Tell if the stream is open. */ template bool claw::net::basic_socket_stream::is_open() const { return m_buffer.is_open(); } // basic_socket_stream::is_open() /*----------------------------------------------------------------------------*/ /** * \brief Set the number of second to wait before considering nothing will come * in the socket. * \param read_limit The number of seconds. Negative values mean infinity. */ template void claw::net::basic_socket_stream::set_read_time_limit ( int read_limit ) { m_buffer.set_read_time_limit(read_limit); } // // basic_socket_stream::set_read_time_limit() /*----------------------------------------------------------------------------*/ /** * \brief Connect the socket to an address. * \param address The address to which we will connect. * \param port The port number to use for the connection. */ template void claw::net::basic_socket_stream::open ( const char* address, int port ) { if ( !m_buffer.open(address, port) ) this->setstate(std::ios_base::failbit); else this->clear(); } // basic_socket_stream::open() /*----------------------------------------------------------------------------*/ /** * \brief Link the socket to a file descriptor. * \param fd The file descriptor. * \remark This method should be only called by claw::net::socket_server. */ template void claw::net::basic_socket_stream::open( int fd ) { if ( !m_buffer.open(fd) ) this->setstate(std::ios_base::failbit); else this->clear(); } // basic_socket_stream::open() /*----------------------------------------------------------------------------*/ /** * \brief Close the connection. */ template void claw::net::basic_socket_stream::close() { if ( !m_buffer.close() ) this->setstate(std::ios_base::failbit); } // basic_socket_stream::close() libclaw-1.7.4/claw/impl/string_algorithm.tpp000066400000000000000000000272471216507631600211530ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file string_algorithm.tpp * \brief Implementation of the algorithms on strings. * \author Julien Jorge */ #include #include #include #include #include /*----------------------------------------------------------------------------*/ /** * \brief A portable version of std::getline( is, str, '\\n' ) that removes a * tailing '\\r'. * \param is The stream in which we read. * \param str The line read from the stream. */ template StreamType& claw::text::getline( StreamType& is, StringType& str ) { std::getline( is, str ); if ( !str.empty() ) if ( str[ str.size() - 1 ] == typename StringType::value_type('\r') ) str.erase( str.size() - 1 ); return is; } // getline() /*----------------------------------------------------------------------------*/ /** * \brief Remove characters at the begining of a string. * \param str The string to modify. * \param s The characters to remove. */ template void claw::text::trim_left( StringType& str, const typename StringType::value_type* const s ) { typename StringType::size_type p = str.find_first_not_of(s); if (p != StringType::npos) str = str.substr(p); } // trim_left() /*----------------------------------------------------------------------------*/ /** * \brief Remove characters at the end of a string. * \param str The string to modify. * \param s The characters to remove. */ template void claw::text::trim_right( StringType& str, const typename StringType::value_type* const s ) { typename StringType::size_type p = str.find_last_not_of(s); if (p != StringType::npos) str = str.substr( 0, p+1 ); } // trim_right() /*----------------------------------------------------------------------------*/ /** * \brief Remove characters at the begining end at the end of a string. * \param str The string to modify. * \param s The characters to remove. */ template void claw::text::trim( StringType& str, const typename StringType::value_type* const s ) { typename StringType::size_type first = str.find_first_not_of(s); typename StringType::size_type last = str.find_last_not_of(s); if (first != StringType::npos) str = str.substr( first, last - first + 1 ); } // trim() /*----------------------------------------------------------------------------*/ /** * \brief Squeeze successive characters of a string into one character. * \param str The string to modify. * \param s The characters to remove. * * \b Example : * * std::string s("word aaa bbb abab"); * claw::squeeze( s, "ab" ); * std::cout << s << std::end; // result is "word a b abab" * */ template void claw::text::squeeze( StringType& str, const typename StringType::value_type* const s ) { typedef typename StringType::size_type size_type; size_type first(0); do { first = str.find_first_of(s, first); if ( first != StringType::npos ) { size_type last = str.find_first_not_of(str[first], first+1); if ( last == StringType::npos ) str = str.substr(0, first+1); else if ( last - first > 1 ) str = str.substr(0, first+1) + str.substr(last); ++first; } } while ( (first != StringType::npos) && (first != str.length()) ); } // squeeze() /*----------------------------------------------------------------------------*/ /** * \brief Replace a set of characters by other characters. * \param str The string to modify. * \param e1 The characters to remove. * \param e2 The characters replacing the ones in \a e1. * * \return The number of replaced characters. * * Each character e1[i] will be replaced with e2[i]. If \a e1 is smaller than * \a e2, the latter will be completed by repeating its last character. * * \b Example : * * std::string s("word aaa bbb abab"); * claw::replace( s, "ab", "ba" ); * std::cout << s << std::end; // result is "word bbb aaa baba" * */ template std::size_t claw::text::replace ( StringType& str, const StringType& e1, const StringType& e2 ) { return claw::replace ( str.begin(), str.end(), e1.begin(), e1.end(), e2.begin(), e2.end() ); } // replace() /*----------------------------------------------------------------------------*/ /** * \brief Test if the content of a string is immediately convertible to a type. * \param str The string to test. */ template bool claw::text::is_of_type( const StringType& str ) { std::basic_istringstream< typename StringType::value_type, typename StringType::traits_type, typename StringType::allocator_type > iss(str); T val; bool result = false; if ( iss >> val ) result = iss.eof(); return result; } // is_of_type() /*----------------------------------------------------------------------------*/ /** * \brief Split a string into several substrings, according to a given * separator. * \param sequence A sequence in which the substrings are added. * \param str The string to split. * \param sep The separator on which the string is splitted. */ template void claw::text::split ( Sequence& sequence, const typename Sequence::value_type& str, const typename Sequence::value_type::value_type sep ) { split(sequence, str.begin(), str.end(), sep); } // split() /*----------------------------------------------------------------------------*/ /** * \brief Split a string into several substrings, according to a given * separator. * \param sequence A sequence in which the substrings are added. * \param first Iterator on the beginning of the string to split. * \param last Iterator just past the end of the string to split. * \param sep The separator on which the string is splitted. */ template void claw::text::split ( Sequence& sequence, typename Sequence::value_type::const_iterator first, typename Sequence::value_type::const_iterator last, const typename Sequence::value_type::value_type sep ) { typedef typename Sequence::value_type string_type; string_type line; std::basic_istringstream< typename string_type::value_type, typename string_type::traits_type, typename string_type::allocator_type > iss( string_type(first, last) ); while ( std::getline(iss, line, sep) ) *std::insert_iterator(sequence, sequence.end()) = line; } // split() /*----------------------------------------------------------------------------*/ /** * \brief Find escaped symbols in a sequence of characters and replace them by * their c-equivalent. * * \param first Iterator on the beginning of the string to escape. * \param last Iterator just past the end of the string to escape. * \param out Iterator on the beginning of the output string. * \pre \a out points on a range long enough to store the resulting string. * * \code * std::string s("\\a\\t\\n\\r"); * std::string r; * * claw::text::c_escape( s.begin(), s.end(), std::insert_iterator(r, r.end()) ); * * if ( r == "\a\t\n\r" ) * std::cout << "It works!" << std::endl; * \endcode * * \remark This method has not been tested with wide chars yet. */ template void claw::text::c_escape ( InputIterator first, InputIterator last, OutputIterator out ) { typedef typename std::iterator_traits::value_type char_type; typedef std::basic_string string_type; const string_type oct("01234567"); const string_type hex("0123456789ABCDEFabcdef"); bool escape(false); for ( ; first!=last; ++out ) if ( escape ) { switch( *first ) { case 'a': *out = '\a'; ++first; break; case 'b': *out = '\b'; ++first; break; case 'f': *out = '\f'; ++first; break; case 'n': *out = '\n'; ++first; break; case 'r': *out = '\r'; ++first; break; case 't': *out = '\t'; ++first; break; case 'v': *out = '\v'; ++first; break; case 'o': { ++first; int v(0); const InputIterator e ( find_first_not_of(first, last, oct.begin(), oct.end()) ); std::basic_istringstream iss( string_type(first, e) ); iss >> std::oct >> v; *out = (char_type)v; first = e; break; } case 'x': { ++first; int v(0); const InputIterator e ( find_first_not_of(first, last, hex.begin(), hex.end()) ); std::basic_istringstream iss( string_type(first, e) ); iss >> std::hex >> v; *out = (char_type)v; first = e; break; } default: *out = *first; ++first; } escape = false; } else if ( *first == '\\' ) { escape = true; ++first; } else { *out = *first; ++first; } } // c_escape() /*----------------------------------------------------------------------------*/ /** * \brief Check if a string matches a given pattern. * \param pattern The pattern. * \param text The text to check. * \param any_sequence A value representing any sequence of values, empty or * not. * \param zero_or_one A value representing any value or no value. * \param any A value representing any value. */ template bool claw::text::glob_match ( const StringType& pattern, const StringType& text, const typename StringType::value_type any_sequence, const typename StringType::value_type zero_or_one, const typename StringType::value_type any ) { return claw::glob_match ( pattern.begin(), pattern.end(), text.begin(), text.end(), any_sequence, zero_or_one, any ); } // glob_match() /*----------------------------------------------------------------------------*/ /** * \brief Check if a string may match a given pattern. * \param pattern The pattern. * \param text The text to check. * \param any_sequence A value representing any sequence of values, empty or * not. * \param zero_or_one A value representing any value or no value. * \param any A value representing any value. */ template bool claw::text::glob_potential_match ( const StringType& pattern, const StringType& text, const typename StringType::value_type any_sequence, const typename StringType::value_type zero_or_one, const typename StringType::value_type any ) { return claw::glob_potential_match ( pattern.begin(), pattern.end(), text.begin(), text.end(), any_sequence, zero_or_one, any ); } // glob_potential_match() libclaw-1.7.4/claw/impl/targa_reader.tpp000066400000000000000000000244551216507631600202150ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file targa_reader.tpp * \brief Implementation of the template methods of the targa::reader class and * subclasses. * \author Julien Jorge */ #include #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param f The file to read. */ template< typename Pixel > claw::graphic::targa::reader::file_input_buffer::file_input_buffer ( std::istream& f ) : buffered_istream(f) { } // targa::reader::file_input_buffer::file_input_buffer //*****************************************************************************/ /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param f The file to read. * \param p The color palette. */ template< typename Pixel > claw::graphic::targa::reader::mapped_file_input_buffer:: mapped_file_input_buffer ( std::istream& f, const color_palette32& p ) : buffered_istream(f), m_palette(p) { } // targa::reader::mapped_file_input_buffer::mapped_file_input_buffer //*****************************************************************************/ /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param img The targa image we're loading. * \param up_down Tell if the image is stored from top to bottom. * \param left_right Tell if the image is stored from left to right. */ template claw::graphic::targa::reader::rle_targa_output_buffer:: rle_targa_output_buffer( image& img, bool up_down, bool left_right ) : m_image(img), m_x_inc(left_right ? 1 : -1), m_y_inc(up_down ? 1 : -1) { if (up_down) m_y = 0; else m_y = m_image.height() - 1; if (left_right) m_x = 0; else m_x = m_image.width() - 1; } // targa::reader::rle_targa_output_buffer::rle_targa_output_buffer() /*----------------------------------------------------------------------------*/ /** * \brief Copy a pixel a certain number of times. * \param n The number of pixel to write. * \param pattern The pixel to copy. */ template void claw::graphic::targa::reader::rle_targa_output_buffer::fill ( unsigned int n, rgba_pixel_8 pattern ) { assert( (int)(m_x + m_x_inc * n) >= -1 ); assert( m_x + m_x_inc * n <= m_image.width() ); const int bound = (int)m_x + m_x_inc * n; int x = m_x; for ( ; x != bound; x += m_x_inc ) m_image[m_y][x] = pattern; adjust_position(x); } // targa::reader::rle_targa_output_buffer::fill() /*----------------------------------------------------------------------------*/ /** * \brief Direct copy of a certain number of pixels from the file. * \param n The number of pixels to write. * \param buffer The buffer from which we read. */ template void claw::graphic::targa::reader::rle_targa_output_buffer::copy ( unsigned int n, input_buffer_type& buffer ) { assert( (int)(m_x + m_x_inc * n) >= -1 ); assert( m_x + m_x_inc * n <= m_image.width() ); const int bound = (int)m_x + m_x_inc * n; int x = m_x; for ( ; x != bound; x += m_x_inc ) m_image[m_y][x] = buffer.get_pixel(); adjust_position(x); } // targa::reader::rle_targa_output_buffer::copy() /*----------------------------------------------------------------------------*/ /** * \brief Tell if we have completely filled the image. */ template bool claw::graphic::targa::reader::rle_targa_output_buffer:: completed() const { return ( (int)m_y == -1 ) || ( m_y == m_image.height() ); } // targa::reader::rle_targa_output_buffer::completed() /*----------------------------------------------------------------------------*/ /** * \brief Recalculate the position in the file. * \param x The x-coordinate where we stopped. * * If \a x is lower tha zero, the position is set at the end of the previous * line ; if \a is greater or equal to the width of the image, the position is * set at the begining of the next line ; otherwise the position is set to \a x. */ template void claw::graphic::targa::reader::rle_targa_output_buffer:: adjust_position(int x) { if (x < 0) { m_x = m_image.width() - 1; m_y += m_y_inc; } else if (x >= (int)m_image.width()) { m_x = 0; m_y += m_y_inc; } else m_x = x; } // targa::reader::rle_targa_output_buffer::adjust_position() //*****************************************************************************/ /*----------------------------------------------------------------------------*/ /** * \brief Get the type of the following data in the input buffer. * \param input The input stream (the targa file). * \param output The output stream (the targa image). */ template< typename InputBuffer, typename OutputBuffer > void claw::graphic::targa::reader::rle_targa_decoder:: read_mode( input_buffer_type& input, output_buffer_type& output ) { this->m_mode = this->stop; bool ok = !output.completed(); if ( ok && (input.remaining() < 1) ) ok = input.read_more(1); if (ok) { char key = input.get_next(); this->m_count = (key & 0x7F) + 1; if (key & 0x80) // compressed { this->m_mode = this->compressed; this->m_pattern = input.get_pixel(); } else this->m_mode = this->raw; } } // targa::reader::rle_targa_decoder::read_mode() //*****************************************************************************/ /*----------------------------------------------------------------------------*/ /** * \brief Load an uncompressed true color targa file. * \param h File's header, must have been read before call. * \param f Targa file. * \param palette The color palette of the image. * \pre f.is_open() */ template void claw::graphic::targa::reader::load_color_mapped_raw ( const header& h, std::istream& f, const color_palette32& palette ) { /* We use a part of the rle framework but there isn't any compressed data here. We only use the direct copy of the rle algorithm. */ typedef mapped_file_input_buffer input_buffer_type; rle_targa_output_buffer output ( m_image, h.image_specification.up_down_oriented(), h.image_specification.left_right_oriented() ); input_buffer_type input(f, palette); for ( unsigned int i=0; i!=m_image.height(); ++i ) output.copy( m_image.width(), input ); } // targa::reader::load_true_color_raw() /*----------------------------------------------------------------------------*/ /** * \brief Load a RLE color mapped targa file. * \param h File's header, must have been read before call. * \param f Targa file. * \param palette The color palette of the image. * \pre f.is_open() */ template void claw::graphic::targa::reader::decompress_rle_color_mapped ( const header& h, std::istream& f, const color_palette32& palette ) { Decoder decoder; typename Decoder::output_buffer_type output_buffer (m_image, h.image_specification.up_down_oriented(), h.image_specification.left_right_oriented() ); typename Decoder::input_buffer_type input_buffer(f, palette); decoder.decode(input_buffer, output_buffer); } // targa::reader::decompress_rle_color_mapped() /*----------------------------------------------------------------------------*/ /** * \brief Load an uncompressed true color targa file. * \param h File's header, must have been read before call. * \param f Targa file. * \pre f.is_open() && !h.color_map */ template void claw::graphic::targa::reader::load_true_color_raw ( const header& h, std::istream& f ) { assert(!h.color_map); /* We use a part of the rle framework but there isn't any compressed data here. We only use the direct copy of the rle algorithm. */ typedef file_input_buffer input_buffer_type; rle_targa_output_buffer output ( m_image, h.image_specification.up_down_oriented(), h.image_specification.left_right_oriented() ); input_buffer_type input(f); for ( unsigned int i=0; i!=m_image.height(); ++i ) output.copy( m_image.width(), input ); } // targa::reader::load_true_color_raw() /*----------------------------------------------------------------------------*/ /** * \brief Load a true color RLE targa file. * \param h File's header, must have been read before call. * \param f Targa file. * \pre f.is_open() && !h.color_map */ template void claw::graphic::targa::reader::decompress_rle_true_color ( const header& h, std::istream& f ) { assert(!h.color_map); Decoder decoder; typename Decoder::output_buffer_type output_buffer (m_image, h.image_specification.up_down_oriented(), h.image_specification.left_right_oriented() ); typename Decoder::input_buffer_type input_buffer(f); decoder.decode(input_buffer, output_buffer); } // targa::reader::decompress_rle_true_color() /*----------------------------------------------------------------------------*/ /** * \brief Load the content of the color palette. * \param f Targa file. * \param palette (out) The color palette. */ template void claw::graphic::targa::reader::load_palette_content ( std::istream& f, color_palette32& palette ) const { file_input_buffer input(f); for (unsigned int i=0; i!=palette.size(); ++i) palette[i] = input.get_pixel(); } // targa::reader::load_palette_content() libclaw-1.7.4/claw/impl/targa_writer.tpp000066400000000000000000000072471216507631600202670ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file targa_writer.tpp * \brief Implementation of the template methods of the targa::writer class and * subclasses. * \author Julien Jorge */ #include #include //********************* targa::writer::file_output_buffer ********************** /*----------------------------------------------------------------------------*/ /** * \brief Constructor. * \param os The */ template claw::graphic::targa::writer::file_output_buffer::file_output_buffer ( std::ostream& os ) : m_stream(os) { } // targa::writer::file_output_buffer::file_output_buffer() /*----------------------------------------------------------------------------*/ /** * \brief Code a pixel. * \param n The number of time the pixel appears. * \param pattern The value of the pixel. */ template void claw::graphic::targa::writer::file_output_buffer::encode ( unsigned int n, pattern_type pattern ) { assert( n <= max_encodable() ); assert( n >= min_interesting() ); unsigned char key = (n-1) | 0x80; m_stream << key; order_pixel_bytes( pattern ); } // targa::writer::file_output_buffer::encode() /*----------------------------------------------------------------------------*/ /** * \brief Write raw data int the stream. * \param first Iterator on the first data. * \param last Iterator past the last data. */ template template void claw::graphic::targa::writer::file_output_buffer::raw ( Iterator first, Iterator last ) { unsigned int n = std::distance(first, last); unsigned int full = n / max_encodable(); unsigned int remaining = n % max_encodable(); unsigned char key = max_encodable() - 1; for (unsigned int i=0; i!=full; ++i) { m_stream << key; for (unsigned int j=0; j!=max_encodable(); ++j, ++first) order_pixel_bytes( *first ); } if (remaining) { key = remaining - 1; m_stream << key; for (unsigned int j=0; j!=remaining; ++j, ++first) order_pixel_bytes( *first ); } } // targa::writer::file_output_buffer::raw() /*----------------------------------------------------------------------------*/ /** * \brief Get the minimum number of pixels needed for encoding. */ template unsigned int claw::graphic::targa::writer::file_output_buffer::min_interesting() const { return 2; } // targa::writer::file_output_buffer::min_interesting() /*----------------------------------------------------------------------------*/ /** * \brief Get the maximum number of pixel a code can encode. */ template unsigned int claw::graphic::targa::writer::file_output_buffer::max_encodable() const { return 0x80; } // targa::writer::file_output_buffer::max_encodable() libclaw-1.7.4/claw/impl/tree.tpp000066400000000000000000000125031216507631600165230ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file tree.tpp * \brief Implementation of the claw::tree class. * \author Julien Jorge */ /*----------------------------------------------------------------------------*/ /** * \brief Default constructor. */ template claw::tree::tree() : value() { } // tree::tree() /*----------------------------------------------------------------------------*/ /** * \brief Constructor with initialization. * \param v The value of the root node. */ template claw::tree::tree( const T& v ) : value(v) { } // tree::tree() /*----------------------------------------------------------------------------*/ /** * \brief Equality operator. * \param that The tree to compare to. */ template bool claw::tree::operator==( const self_type& that ) const { bool result = ( value == that.value ); if (result) { typename child_list::const_iterator it_me = m_child.begin(); typename child_list::const_iterator it_him = that.m_child.begin(); typename child_list::const_iterator eit_me = m_child.end(); typename child_list::const_iterator eit_him = that.m_child.end(); while ( result && (it_me!=eit_me) && (it_him!=eit_him) ) result = (*it_me == *it_him); if ( (it_me!=eit_me) || (it_him!=eit_him) ) result = false; } return result; } // tree::operator==() /*----------------------------------------------------------------------------*/ /** * \brief Tell if this node is a leaf (ie. it has no child). */ template bool claw::tree::is_leaf() const { return m_child.empty(); } // tree::is_leaf() /*----------------------------------------------------------------------------*/ /** * \brief Add a child to this node. * \param v The value of the child to add. */ template typename claw::tree::self_type& claw::tree::add_child( const T& v ) { m_child.push_back( self_type(v) ); return m_child.back(); } // tree::add_child() /*----------------------------------------------------------------------------*/ /** * \brief Add a child subtree to this node. * \param v The tree to add. */ template typename claw::tree::self_type& claw::tree::add_child( const self_type& v ) { m_child.push_back( v ); } // tree::add_child() /*----------------------------------------------------------------------------*/ /** * \brief Search the first child having a given value. * \param v The value of the child to find. */ template typename claw::tree::iterator claw::tree::find( const T& v ) { typename child_list::iterator it; bool found = false; for ( it=m_child.begin(); !found && (it!=end()) ; ) if ( it->value == v ) found = true; else ++it; return iterator( it ); } // tree::find() /*----------------------------------------------------------------------------*/ /** * \brief Search the first child having a given value. * \param v The value of the child to find. */ template typename claw::tree::const_iterator claw::tree::find( const T& v ) const { typename child_list::const_iterator it; bool found = false; for ( it=m_child.begin(); !found && (it!=end()) ; ) if ( it->value == v ) found = true; else ++it; return const_iterator( it ); } // tree::find() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator on the begining of the children. */ template typename claw::tree::iterator claw::tree::begin() { return iterator( m_child.begin() ); } // tree::begin()() /*----------------------------------------------------------------------------*/ /** * \brief Get an iterator just past the end of the children. */ template typename claw::tree::iterator claw::tree::end() { return iterator( m_child.end() ); } // tree::end() /*----------------------------------------------------------------------------*/ /** * \brief Get a constant iterator on the begining of the children. */ template typename claw::tree::const_iterator claw::tree::begin() const { return const_iterator( m_child.begin() ); } // tree::begin() /*----------------------------------------------------------------------------*/ /** * \brief Get a constant iterator just past the end of the children. */ template typename claw::tree::const_iterator claw::tree::end() const { return const_iterator( m_child.end() ); } // tree::end() libclaw-1.7.4/claw/impl/trie.tpp000066400000000000000000000140311216507631600165250ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file trie.tpp * \brief Implementation of the trie structure. * \author Julien Jorge */ #include #include //*************************** trie::trie_node ********************************* /*---------------------------------------------------------------------------*/ /** * \brief Trie node constructor. * \param val Value of the node. * \param c Count for the node. * \post (value==val) && (count==c) */ template claw::trie::trie_node::trie_node( const T& val, unsigned int c /*= 0*/ ) : claw::binary_node< typename claw::trie::trie_node >(), value(val), count(0) { } // trie_node() [constructor] /*---------------------------------------------------------------------------*/ /** * \brief Trie node copy constructor. * \param that Node to copy from. */ template claw::trie::trie_node::trie_node( const trie_node& that ) : claw::binary_node< typename claw::trie::trie_node >(that), value(that.value), count(that.count) { } // trie_node [copy constructor] //********************************* trie ************************************** /*---------------------------------------------------------------------------*/ template typename claw::trie::value_equal_to claw::trie::s_value_equal_to; /*---------------------------------------------------------------------------*/ /** * \brief Trie constructor. * \post empty() */ template claw::trie::trie() { m_size = 0; m_tree = NULL; assert(empty()); } // trie() [constructor] /*---------------------------------------------------------------------------*/ /* * \brief Trie copy constructor. */ template claw::trie::trie( const claw::trie& that ) { if (that.m_tree) m_tree = new trie_node( *that.m_tree ); else m_tree = NULL; m_size = that.m_size; } // trie() [copy constructor] /*---------------------------------------------------------------------------*/ /** * \brief Trie destructor. */ template claw::trie::~trie() { if (m_tree) delete m_tree; } // ~trie() [destructor] /*---------------------------------------------------------------------------*/ /** * \brief Gets size (words count) of the structure. */ template unsigned int claw::trie::size() const { return m_size; } // size() /*---------------------------------------------------------------------------*/ /** * \brief Tell if the structure is empty or not. */ template bool claw::trie::empty() const { return m_tree==NULL; } // empty() /*---------------------------------------------------------------------------*/ /** * \brief Clear the trie. * \post this->empty() == true */ template void claw::trie::clear() { if (m_tree) { delete m_tree; m_tree = NULL; m_size = 0; } } // clear() /*---------------------------------------------------------------------------*/ /** * \brief Add a word to the structure. * \remark Type requirements : * - *InputIterator is T. * \param first First item of the word. * \param last Item just after the last to add. * \pre first != last * \post !empty() && count(first, last) == old(count(first, last)) + 1 */ template template void claw::trie::insert(InputIterator first, InputIterator last) { assert( first != last ); trie_node_ptr* p = &m_tree; // for tree search trie_node_ptr last_node = NULL; // last node of the inserted word // Try to insert a maximum of items while ( *p && (first!=last) ) if ( s_value_equal_to((*p)->value, *first) ) { last_node = *p; p = & (*p)->right; ++first; } else p = & (*p)->left; // If we haven't inserted the full word, // create the whole subtree. while (first != last) { *p = new trie_node(*first); last_node = *p; ++first; p = & (*p)->right; } ++(last_node->count); // Don't forget to increase words count. ++m_size; } // insert() /*---------------------------------------------------------------------------*/ /** * \brief Gets a word count. * \remark Type requirements : * - *InputIterator is T. * \param first First item of the word. * \param last Item just after the last to find. * \pre first != last */ template template unsigned int claw::trie::count(InputIterator first, InputIterator last) { assert( first != last ); trie_node_ptr* p = & m_tree; // for tree search trie_node_ptr last_node = NULL; // last node of the word // Try to find the word while ( *p && (first!=last) ) if ( s_value_equal_to((*p)->value, *first) ) { last_node = *p; p = & (*p)->right; ++first; } else p = & (*p)->left; // found ? if (first==last) return last_node->count; else return 0; } // count() libclaw-1.7.4/claw/impl/vector_2d.tpp000066400000000000000000000075361216507631600174650ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file vector_2d.tpp * \brief Implementation of claw::math::vector_2d class. * \author Julien Jorge */ #include /*----------------------------------------------------------------------------*/ /** * \brief Constructor. */ template claw::math::vector_2d::vector_2d() { } // vector_2d::vector_2d() [constructor] /*----------------------------------------------------------------------------*/ /** * \brief Copy constructor. */ template template claw::math::vector_2d::vector_2d(const coordinate_2d& that) : super(that) { } // vector_2d::vector_2d() [copy constructor] /*----------------------------------------------------------------------------*/ /** * \brief Construct a vector from two points. */ template template claw::math::vector_2d::vector_2d ( const coordinate_2d& p1, const coordinate_2d& p2 ) : super( p2.x - p1.x, p2.y - p1.y ) { } // vector_2d::vector_2d() [constructor from two points] /*----------------------------------------------------------------------------*/ /** * \brief Constructor with initialization. * \param _x x value. * \param _y y Value. */ template claw::math::vector_2d::vector_2d(const value_type& _x, const value_type& _y) : super(_x, _y) { } // vector_2d::vector_2d() [constructor whit values] /*----------------------------------------------------------------------------*/ /** * \brief Gets vector length. */ template typename claw::math::vector_2d::value_type claw::math::vector_2d::length() const { return std::sqrt( (this->x * this->x) + (this->y * this->y) ); } // vector_2d::length() /*----------------------------------------------------------------------------*/ /** * \brief Normalize the vector. */ template void claw::math::vector_2d::normalize() { value_type l = length(); if (l != 0) { this->x /= l; this->y /= l; } } // vector_2d::normalize() /*----------------------------------------------------------------------------*/ /** * \brief Get a vector orthonormal to this vector. */ template claw::math::vector_2d claw::math::vector_2d::get_orthonormal_clockwise() const { return self_type(this->y, -this->x); } // vector_2d::get_orthonormal_clockwise() /*----------------------------------------------------------------------------*/ /** * \brief Get a vector orthonormal to this vector. */ template claw::math::vector_2d claw::math::vector_2d::get_orthonormal_anticlockwise() const { return self_type(-this->y, this->x); } // vector_2d::get_orthonormal_anticlockwise() /*----------------------------------------------------------------------------*/ /** * \brief Dot product. * \param that The other operand. */ template typename claw::math::vector_2d::value_type claw::math::vector_2d::dot_product(const self_type& that) const { return this->x * that.x + this->y * that.y; } // vector_2d::dot_product() libclaw-1.7.4/claw/isocket_stream.hpp000066400000000000000000000062751216507631600176340ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file isocket_stream.hpp * \brief A class to use any socket as a classic standard input stream. * \author Julien Jorge */ #ifndef __CLAW_ISOCKET_STREAM_HPP__ #define __CLAW_ISOCKET_STREAM_HPP__ #include #include namespace claw { namespace net { /** * \brief A class to use any socket as a classic standard input stream. * \author Julien Jorge */ template< typename CharT, typename Traits = std::char_traits > class basic_isocket_stream : public std::basic_istream { public: /** \brief The type of the characters in the stream. */ typedef CharT char_type; /** \brief The traits carry some informations about the char_type. */ typedef Traits traits_type; /** \brief The type used to represent integers. */ typedef typename traits_type::int_type int_type; /** \brief The type used to represent a position in the stream. */ typedef typename traits_type::pos_type pos_type; /** \brief The type used to represent a delta in the positions. */ typedef typename traits_type::off_type off_type; /** \brief The type of the buffer manipulated by this stream. */ typedef basic_socketbuf buffer_type; private: /** \brief The type of the parent class. */ typedef std::basic_istream super; public: basic_isocket_stream(); basic_isocket_stream( const std::string& address, int port ); ~basic_isocket_stream(); buffer_type* rdbuf() const; bool is_open() const; void open( const std::string& address, int port ); void open( int fd ); void close(); private: /** \brief The buffer used for input operations. */ buffer_type m_buffer; }; // class basic_isocket_stream /** \brief Implementation of the basic_isocket_stream for the char type. */ typedef basic_isocket_stream isocket_stream; /** \brief Implementation of the basic_isocket_stream for the wide characters. */ typedef basic_isocket_stream wisocket_stream; } // namespace net } // namespace claw #include #endif // __CLAW_ISOCKET_STREAM_HPP__ libclaw-1.7.4/claw/it_index.hpp000066400000000000000000000126501216507631600164150ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file it_index.hpp * \brief A class to manage an index and an iterator easily. * \author Julien Jorge */ #ifndef __CLAW_IT_INDEX_HPP__ #define __CLAW_IT_INDEX_HPP__ #include namespace claw { /** * \brief A class to manage an index and an iterator easily. * \param T Type of the iterator. * \author Julien Jorge */ template class it_index { public: typedef typename std::iterator_traits::value_type value_type; typedef typename std::iterator_traits::difference_type difference_type; typedef typename std::iterator_traits::pointer pointer; typedef typename std::iterator_traits::reference reference; private: /** \brief Iterator. */ T m_it; /** \brief Iterator's position. */ int m_index; public: /** \brief Constructor. */ it_index() : m_it(), m_index() { } /** * \brief Constructor. * \param it The iterator. * \param index Iterator's position. */ it_index(const T& it, int index=0) : m_it(it), m_index(index) { } /** * \brief Copy constructor. * \param that it_index to copy from. */ it_index( const it_index& that ) : m_it( that.m_it ), m_index( that.m_index ) { } /** * \brief Change the current pair. * \param it The new iterator. * \param index New iterator's position. */ void set( const T& it, int index ) { m_it = it; m_index = index; } bool operator<( const it_index& that ) const { return m_index < that.m_index; } bool operator<( const T& it ) const { return m_it < it; } bool operator<( int index ) const { return m_index < index; } bool operator<=( const it_index& that ) const { return (*this < that) || (*this == that); } bool operator<=( const T& it ) const { return m_it <= it; } bool operator<=( int index ) const { return m_index <= index; } bool operator>( const it_index& that ) const { return m_index > that.m_index; } bool operator>( const T& it ) const { return m_it > it; } bool operator>( int index ) const { return m_index > index; } bool operator>=( const it_index& that ) const { return (*this > that) || (*this == that); } bool operator>=( const T& it ) const { return m_it >= it; } bool operator>=( int index ) const { return m_index >= index; } bool operator==( const it_index& that ) const { return (m_it == that.m_it) && (m_index == that.m_index); } bool operator==( const T& it ) const { return m_it == it; } bool operator==( int index ) const { return m_index==index; } bool operator!=( const it_index& that ) const { return !(*this == *that); } bool operator!=( const T& it ) const { return m_it != it; } bool operator!=( int index ) const { return m_index!=index; } it_index operator+( int index ) const { return it_index(m_it + index, m_index + index); } it_index operator-( int index ) const { return it_index(m_it - index, m_index - index); } it_index operator*( int index ) const { return it_index(m_it + (index-1) * m_index, m_index * index); } it_index operator/( int index ) const { return it_index(m_it - (m_index - m_index/index), m_index / index); } reference operator*() const { return *m_it; } pointer operator->() const { return &*m_it; } // Préincrément it_index& operator++() { ++m_it; ++m_index; return *this; } // Postincrément it_index operator++(int) { it_index r(*this); ++(this); return r; } // Préincrément it_index& operator--() { --m_it; --m_index; return *this; } // Postincrément it_index operator--(int) { it_index r(*this); --(this); return r; } it_index& operator+=( int index ) { m_it += index; m_index += index; return *this; } it_index& operator-=( int index ) { m_it -= index; m_index -= index; return *this; } it_index& operator*=( int index ) { m_it += (index-1) * m_index; m_index *= index; return *this; } it_index& operator/=( int index ) { m_it -= m_index - m_index/index; m_index /= index; return *this; } operator int() const { return m_index; } operator T() const { return m_it; } }; // it_index; } // namespace claw #endif // __CLAW_IT_INDEX_HPP__ libclaw-1.7.4/claw/iterator.hpp000066400000000000000000000255251216507631600164500ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file iterator.hpp * \brief Some special kind of iterators. As an example: iterator on the keys of * a map. * \author Julien Jorge */ #ifndef __CLAW_ITERATOR_HPP__ #define __CLAW_ITERATOR_HPP__ #include namespace claw { /*-------------------------------------------------------------------------*/ /** * \brief Base class for wrapped iterators. * \author Julien Jorge */ template< typename Category, typename Value, typename Iterator, typename Function > class wrapped_iterator_by_category { }; // class wrapped_iterator_by_category /*-------------------------------------------------------------------------*/ /** * \brief Base class for wrapped iterators, specialized for forward iterators. * \author Julien Jorge */ template class wrapped_iterator_by_category { public: typedef typename std::iterator_traits::difference_type difference_type; typedef Value value_type; typedef value_type* pointer; typedef value_type& reference; typedef typename std::iterator_traits::iterator_category iterator_category; typedef wrapped_iterator_by_category self_type; public: wrapped_iterator_by_category() {} wrapped_iterator_by_category( const Iterator& it ) : m_it(it) { } wrapped_iterator_by_category( const Iterator& it, const Function& f ) : m_it(it), m_fun(f) { } template wrapped_iterator_by_category ( const wrapped_iterator_by_category& that ) : m_it(that.get_iterator()), m_fun(that.get_function()) { } const Iterator& get_iterator() const { return m_it; } const Function& get_function() const { return m_fun; } self_type& operator++() { ++m_it; return *this; } self_type operator++(int) { self_type tmp(*this); ++m_it; return tmp; } reference operator*() const { return m_fun(*m_it); } pointer operator->() const { return &m_fun(*m_it); } bool operator==( const self_type& that ) const { return m_it == that.m_it; } bool operator!=( const self_type& that ) const { return m_it != that.m_it; } bool operator==( const Iterator& it ) const { return m_it == it; } bool operator!=( const Iterator& it ) const { return m_it != it; } private: /** \brief The effective iterator. */ Iterator m_it; /** \brief The function applied to the pointed items. */ Function m_fun; }; // class wrapped_iterator_by_category [forward_iterator_tag] /*-------------------------------------------------------------------------*/ /** * \brief Base class for wrapped iterators, specialized for bidirectional * iterators. * \author Julien Jorge */ template class wrapped_iterator_by_category { public: typedef typename std::iterator_traits::difference_type difference_type; typedef Value value_type; typedef value_type* pointer; typedef value_type& reference; typedef typename std::iterator_traits::iterator_category iterator_category; typedef wrapped_iterator_by_category self_type; public: wrapped_iterator_by_category() {} wrapped_iterator_by_category( const Iterator& it ) : m_it(it) { } wrapped_iterator_by_category( const Iterator& it, const Function& f ) : m_it(it), m_fun(f) { } template wrapped_iterator_by_category ( const wrapped_iterator_by_category& that ) : m_it(that.get_iterator()), m_fun(that.get_function()) { } const Iterator& get_iterator() const { return m_it; } const Function& get_function() const { return m_fun; } self_type& operator++() { ++m_it; return *this; } self_type operator++(int) { self_type tmp(*this); ++m_it; return tmp; } self_type& operator--() { --m_it; return *this; } self_type operator--(int) { self_type tmp(*this); --m_it; return tmp; } reference operator*() const { return m_fun(*m_it); } pointer operator->() const { return &m_fun(*m_it); } bool operator==( const self_type& that ) const { return m_it == that.m_it; } bool operator!=( const self_type& that ) const { return m_it != that.m_it; } bool operator==( const Iterator& it ) const { return m_it == it; } bool operator!=( const Iterator& it ) const { return m_it != it; } private: /** \brief The effective iterator. */ Iterator m_it; /** \brief The function applied to the pointed items. */ Function m_fun; }; // class wrapped_iterator_by_category [bidirectional_iterator_tag] /*-------------------------------------------------------------------------*/ /** * \brief Base class for wrapped iterators, specialized for random iterators. * \author Julien Jorge */ template class wrapped_iterator_by_category { public: typedef typename std::iterator_traits::difference_type difference_type; typedef Value value_type; typedef value_type* pointer; typedef value_type& reference; typedef typename std::iterator_traits::iterator_category iterator_category; typedef wrapped_iterator_by_category self_type; public: wrapped_iterator_by_category() {} wrapped_iterator_by_category( const Iterator& it ) : m_it(it) { } wrapped_iterator_by_category( const Iterator& it, const Function& f ) : m_it(it), m_fun(f) { } template wrapped_iterator_by_category ( const wrapped_iterator_by_category & that ) : m_it(that.m_it), m_fun(that.m_fun) { } template wrapped_iterator_by_category ( const wrapped_iterator_by_category& that ) : m_it(that.get_iterator()), m_fun(that.get_function()) { } const Iterator& get_iterator() const { return m_it; } const Function& get_function() const { return m_fun; } self_type& operator++() { ++m_it; return *this; } self_type operator++(int) { self_type tmp(*this); ++m_it; return tmp; } self_type& operator--() { --m_it; return *this; } self_type operator--(int) { self_type tmp(*this); --m_it; return tmp; } reference operator*() const { return m_fun(*m_it); } pointer operator->() const { return &m_fun(*m_it); } bool operator==( const self_type& that ) const { return m_it == that.m_it; } bool operator!=( const self_type& that ) const { return m_it != that.m_it; } bool operator==( const Iterator& it ) const { return m_it == it; } bool operator!=( const Iterator& it ) const { return m_it != it; } bool operator<( const self_type& that ) const { return m_it < that.m_it; } bool operator<=( const self_type& that ) const { return m_it <= that.m_it; } bool operator>( const self_type& that ) const { return m_it > that.m_it; } bool operator>=( const self_type& that ) const { return m_it >= that.m_it; } difference_type operator-( const self_type& that ) const { return m_it - that.m_it; } self_type& operator+=(int n) { m_it += n; return *this; } self_type operator+(int n) const { self_type result(*this); result += n; return result; } self_type& operator-=(int n) { return *this += -n; } self_type operator-(int n) const { self_type result(*this); result -= n; return result; } reference operator[](int n) { return m_fun(m_it[n]); } private: /** \brief The effective iterator. */ Iterator m_it; /** \brief The function applied to the pointed items. */ Function m_fun; }; // class wrapped_iterator_by_category [random_access_iterator_tag] template wrapped_iterator_by_category operator+ ( int n, const wrapped_iterator_by_category < std::random_access_iterator_tag, Value, Iterator, Function >& it ) { return it + n; } template wrapped_iterator_by_category operator- ( int n, const wrapped_iterator_by_category < std::random_access_iterator_tag, Value, Iterator, Function >& it ) { return it - n; } /*-------------------------------------------------------------------------*/ /** * \brief This class defines an iterator resulting of the appliance of a * function to an effective iterator. * * \b Template \b arguments: * - \a Value The value_type of the resulting iterator, * - \a Iterator The original iterator type, * - \a Function The function applied to the pointed values (this is the * wrapper). * * \author Julien Jorge */ template class wrapped_iterator { public: /** \brief This is the type of the iterator that you want. */ typedef wrapped_iterator_by_category < typename std::iterator_traits::iterator_category, Value, Iterator, Function > iterator_type; }; // class wrapped_iterator } // namespace claw #endif // __CLAW_ITERATOR_HPP__ libclaw-1.7.4/claw/jpeg.hpp000066400000000000000000000171161216507631600155410ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file jpeg.hpp * \brief A class for jpeg pictures. * \author Julien Jorge */ #ifndef __CLAW_JPEG_HPP__ #define __CLAW_JPEG_HPP__ #include #include #include #include #include extern "C" { #include } namespace claw { namespace graphic { /** * \brief A class for jpeg pictures. * \author Julien Jorge */ class jpeg : public image { public: /*--------------------------------------------------------------------*/ /** * \brief Error handler that throw an exception instead of exiting the * program. * \brief To be used only in the jpeg::reader and jpeg::writer class. * \author Julien Jorge. */ struct error_manager { /** \brief "public" fields, needed by the jpeg library. */ struct jpeg_error_mgr pub; /** \brief For return to caller */ jmp_buf setjmp_buffer; /** \brief A comprehensive description of the error. */ std::string error_string; }; // struct error_manager /*----------------------------------------------------------------------*/ /** * \brief This class read data from a jpeg file and store it in an image. * \author Julien Jorge */ class reader { // classes that need to be accessible from jpeg callbacks. public: /*--------------------------------------------------------------------*/ /** * \brief Source manager that allow us to read from a std::istream. * \author Julien Jorge */ struct source_manager { public: source_manager( std::istream& is ); ~source_manager(); boolean fill_input_buffer(); void skip_input_data(long num_bytes); public: /** \brief "public" fields, needed by the jpeg library. */ struct jpeg_source_mgr pub; private: /** \brief The stream from which we get data. */ std::istream& m_input; /** \brief Pointer on the begining of the buffer. */ const JOCTET* m_buffer; /** \brief Number of bytes in the buffer. */ const unsigned int m_buffer_size; /** \brief The size of the stream. */ unsigned int m_stream_size; /** \brief The current position in the stream. */ unsigned int m_stream_position; }; // struct source_manager private: /*--------------------------------------------------------------------*/ /** * \brief Functor converting a RGB pixel to a ARGB pixel. */ class RGB_to_pixel32 { public: rgba_pixel_8 operator()( const JSAMPLE* pixel ) const; }; // class RGB_to_pixel32 /*--------------------------------------------------------------------*/ /** * \brief Functor converting a grey level pixel to a ARGB pixel. */ class grayscale_to_pixel32 { public: rgba_pixel_8 operator()( const JSAMPLE* pixel ) const; }; // class grayscale_to_pixel32 public: reader( image& img ); reader( image& img, std::istream& f ); void load( std::istream& f ); private: template void read_data( jpeg_decompress_struct& cinfo, const Convert& pixel_convert ); void read_from_file( std::istream& f ); void decompress( std::istream& f, jpeg_decompress_struct& cinfo ); void create_decompress_info( jpeg_decompress_struct& cinfo, source_manager& infile ) const; private: /** \brief The image in which we store the data we read. */ image& m_image; }; // class reader /*----------------------------------------------------------------------*/ /** * \brief This class write an image in a jpeg file. * \author Julien Jorge */ class writer { public: /** * \brief Parameters of the writing algorithm. */ struct options { public: options(); options( unsigned char compression_quality_, bool progressive_ ); public: /** \brief Quality level to use in the saved stream. */ unsigned char quality; /** \brief Tell if we save a progressive jpeg. */ bool progressive; }; // struct options // classes that need to be accessible from jpeg callbacks. /*--------------------------------------------------------------------*/ /** * \brief Destination manager that allow us to write in a std::ostream. * \author Julien Jorge */ struct destination_manager { public: destination_manager( std::ostream& os ); ~destination_manager(); void flush(); void term(); public: /** \brief "public" fields, needed by the jpeg library. */ struct jpeg_destination_mgr pub; private: /** \brief The stream in which we write the data. */ std::ostream& m_output; /** \brief Pointer on the begining of the buffer. */ JOCTET* m_buffer; /** \brief Number of bytes in the buffer. */ const unsigned int m_buffer_size; }; // struct destination_manager public: writer( const image& img ); writer( const image& img, std::ostream& f, const options& opt = options() ); void save( std::ostream& f, const options& opt = options() ) const; private: void set_options( jpeg_compress_struct& cinfo, const options& opt ) const; void save_image( jpeg_compress_struct& cinfo ) const; void copy_pixel_line( JSAMPLE* data, unsigned int y ) const; void create_compress_info( jpeg_compress_struct& cinfo, destination_manager& outfile ) const; private: /** \brief The image from which we thake the data to save. */ const image& m_image; /** \brief Size, in bytes, of a red/green/blue pixel in a jpeg file. */ static const unsigned int s_rgb_pixel_size; }; // class writer public: jpeg( unsigned int w, unsigned int h ); jpeg( const image& that ); jpeg( std::istream& f ); void save( std::ostream& os, const writer::options& opt = writer::options() ) const; }; // class jpeg } // namespace graphic } // namespace claw #include #endif // __CLAW_JPEG_HPP__ libclaw-1.7.4/claw/jpeg_error_manager.hpp000066400000000000000000000026141216507631600204410ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file jpeg_error_manager.hpp * \brief Methods for the claw::graphic::jpeg::error_manager class. * \remark You should NOT include this file by yourself. * \author Julien Jorge */ #ifndef __CLAW_JPEG_ERROR_MANAGER_HPP__ #define __CLAW_JPEG_ERROR_MANAGER_HPP__ #include namespace claw { namespace graphic { void jpeg__error_manager__error_exit(j_common_ptr cinfo); } // namespace graphic } // namespace claw #endif // __CLAW_JPEG_ERROR_MANAGER_HPP__ libclaw-1.7.4/claw/kmp.hpp000066400000000000000000000046431216507631600154040ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file kmp.hpp * \brief kmp class interface. Use this class for exact pattern matching. * This class uses the Knuth-Morris-Pratt's algorithm. * \author Julien Jorge */ #ifndef __CLAW_KMP_HPP__ #define __CLAW_KMP_HPP__ #include namespace claw { namespace text { /** * \brief Exact pattern finding with the Knuth-Morris-Pratt's algorithm. * \author Julien Jorge */ template class kmp { public: template void operator()(const RandomIterator pattern_begin, const RandomIterator pattern_end, const RandomIterator text_begin, const RandomIterator text_end, UnaryPredicate& action) const; private: unsigned int common_prefix_length( const RandomIterator begin_1, const RandomIterator begin_2, const RandomIterator end_1, const RandomIterator end_2 ) const; void z_boxes(const RandomIterator begin, const RandomIterator end, std::map& out) const; void spi_prime(const RandomIterator begin, const RandomIterator end, std::map& out) const; }; // class kmp } // namespace text } // namespace claw #include #endif // __CLAW_KMP_HPP__ libclaw-1.7.4/claw/line_2d.hpp000066400000000000000000000047701216507631600161320ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file line_2d.hpp * \brief A straight line in a two dimensional space. * \author Julien Jorge */ #ifndef __CLAW_LINE_2D_HPP__ #define __CLAW_LINE_2D_HPP__ #include #include namespace claw { namespace math { /** * \brief A straight line in a two dimensional space. * \author Julien Jorge */ template class line_2d { public: /** \brief The type of the values we store. */ typedef T value_type; /** \brief The type of the current class. */ typedef line_2d self_type; /** \brief The type of the reference point. */ typedef coordinate_2d point_type; /** \brief The type of the direction vector. */ typedef vector_2d direction_type; public: line_2d(); template line_2d( const line_2d& that ); line_2d( const point_type& _origin, const direction_type& _direction ); line_2d( const value_type& ox, const value_type& oy, const value_type& dx, const value_type& dy ); bool parallel( const self_type& that ) const; bool orthogonal( const self_type& that ) const; point_type intersection( const self_type& that ) const; value_type y_value( const value_type& x ) const; public: /** \brief A reference point on the line. */ point_type origin; /** \brief Direction. */ direction_type direction; }; // class point_2d } // namespace math } // namespace claw #include #endif // __CLAW_LINE_2D_HPP__ libclaw-1.7.4/claw/log_level.hpp000066400000000000000000000052571216507631600165670ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file log_level.hpp * \brief A class to pass log information to the loggers. * \author Julien Jorge */ #ifndef __CLAW_LOG_LEVEL_HPP__ #define __CLAW_LOG_LEVEL_HPP__ #include #ifndef CLAW_LOGGER_EXPORT # ifdef CLAW_LOGGER_NO_EXPORT # define CLAW_LOGGER_EXPORT # else # ifdef _WIN32 # ifdef claw_logger_EXPORTS # define CLAW_LOGGER_EXPORT __declspec(dllexport) # else # define CLAW_LOGGER_EXPORT __declspec(dllimport) # endif // def claw_logger_EXPORTS # else // def _WIN32 # define CLAW_LOGGER_EXPORT # endif // def _WIN32 # endif // def CLAW_LOGGER_NO_EXPORT #endif // ndef CLAW_LOGGER_EXPORT namespace claw { /** * \brief Set the level of the next message for logger_system::operator<<(). * \remark Levels from 0 to 15 are reserved to claw. */ class CLAW_LOGGER_EXPORT log_level { public: log_level( int lvl ); log_level( int lvl, const std::string& s ); int get() const; std::string get_string() const; private: /** \brief Value of the level. */ const int m_level; /** \brief String used for prefix for the current message. */ const std::string m_prefix; }; // class log_level /** * \brief Use this level if something goes really bad and your application * may crash. */ CLAW_LOGGER_EXPORT extern log_level log_error; /** * \brief Use this level if a small problem occurs and you can deal with * it without crashing the application. */ CLAW_LOGGER_EXPORT extern log_level log_warning; /** * \brief Use this level if you want to inform the user about a situation that * is not problematic. */ CLAW_LOGGER_EXPORT extern log_level log_verbose; } // namespace claw #endif // __CLAW_LOG_LEVEL_HPP__ libclaw-1.7.4/claw/log_stream.hpp000066400000000000000000000053421216507631600167460ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file log_stream.hpp * \brief Some basic classes for logging. * \author Julien Jorge */ #ifndef __CLAW_LOG_STREAM_HPP__ #define __CLAW_LOG_STREAM_HPP__ #include #include #include #ifndef CLAW_LOGGER_EXPORT # ifdef CLAW_LOGGER_NO_EXPORT # define CLAW_LOGGER_EXPORT # else # ifdef _WIN32 # ifdef claw_logger_EXPORTS # define CLAW_LOGGER_EXPORT __declspec(dllexport) # else # define CLAW_LOGGER_EXPORT __declspec(dllimport) # endif // def claw_logger_EXPORTS # else // def _WIN32 # define CLAW_LOGGER_EXPORT # endif // def _WIN32 # endif // def CLAW_LOGGER_NO_EXPORT #endif // ndef CLAW_LOGGER_EXPORT namespace claw { /** * \brief Base class for streams accepting log output. * \author Julien Jorge */ class CLAW_LOGGER_EXPORT log_stream { public: virtual ~log_stream(); virtual void write( const std::string& str ) = 0; virtual void flush(); }; // class log_stream /** * \brief This class write log messages in std::clog. * \author Julien Jorge */ class CLAW_LOGGER_EXPORT console_logger : public log_stream, public pattern::non_copyable { public: virtual void write( const std::string& str ); virtual void flush(); }; // class console_logger /** * \brief This class write log messages in a file. * \author Julien Jorge */ class CLAW_LOGGER_EXPORT file_logger : public log_stream, public pattern::non_copyable { public: file_logger( const std::string& filename ); virtual ~file_logger(); virtual void write( const std::string& str ); virtual void flush(); private: /** \brief The file in which we write the messages. */ std::ofstream* m_file; }; // class file_logger } // namespace claw #endif // __CLAW_LOG_STREAM_HPP__ libclaw-1.7.4/claw/log_stream_concise.hpp000066400000000000000000000052411216507631600204470ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file log_stream_concise.hpp * \brief A log stream that does not output a message that have been recently * output. * \author Julien Jorge */ #ifndef __CLAW_LOG_STREAM_CONCISE_HPP__ #define __CLAW_LOG_STREAM_CONCISE_HPP__ #include #include #include #ifndef CLAW_LOGGER_EXPORT # ifdef CLAW_LOGGER_NO_EXPORT # define CLAW_LOGGER_EXPORT # else # ifdef _WIN32 # ifdef claw_logger_EXPORTS # define CLAW_LOGGER_EXPORT __declspec(dllexport) # else # define CLAW_LOGGER_EXPORT __declspec(dllimport) # endif // def claw_logger_EXPORTS # else // def _WIN32 # define CLAW_LOGGER_EXPORT # endif // def _WIN32 # endif // def CLAW_LOGGER_NO_EXPORT #endif // ndef CLAW_LOGGER_EXPORT namespace claw { /** * \brief A log stream that does not output a message that have been recently * output. * \author Julien Jorge */ class CLAW_LOGGER_EXPORT log_stream_concise: public log_stream, public pattern::non_copyable { public: explicit log_stream_concise ( log_stream* s, std::size_t max_history_size = 25 ); virtual ~log_stream_concise(); virtual void write( const std::string& str ); virtual void flush(); private: void output_current_line(); private: /** \brief The stream in which the messages are finally written. */ log_stream* m_stream; /** \brief The current line to send into the stream. */ std::string m_current_line; /** \brief Recent lines sent to the stream. */ std::list m_previous_lines; /** \brief Maximum number of lines in the history. */ std::size_t m_max_history_size; }; // class log_stream_concise } // namespace claw #endif // __CLAW_LOG_STREAM_CONCISE_HPP__ libclaw-1.7.4/claw/log_stream_uniq.hpp000066400000000000000000000050521216507631600200000ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file log_stream_uniq.hpp * \brief A log stream that does not output successively the same message. * \author Julien Jorge */ #ifndef __CLAW_LOG_STREAM_UNIQ_HPP__ #define __CLAW_LOG_STREAM_UNIQ_HPP__ #include #include #ifndef CLAW_LOGGER_EXPORT # ifdef CLAW_LOGGER_NO_EXPORT # define CLAW_LOGGER_EXPORT # else # ifdef _WIN32 # ifdef claw_logger_EXPORTS # define CLAW_LOGGER_EXPORT __declspec(dllexport) # else # define CLAW_LOGGER_EXPORT __declspec(dllimport) # endif // def claw_logger_EXPORTS # else // def _WIN32 # define CLAW_LOGGER_EXPORT # endif // def _WIN32 # endif // def CLAW_LOGGER_NO_EXPORT #endif // ndef CLAW_LOGGER_EXPORT namespace claw { /** * \brief A log stream that does not output successively the same message. * \author Julien Jorge */ class CLAW_LOGGER_EXPORT log_stream_uniq: public log_stream, public pattern::non_copyable { public: explicit log_stream_uniq( log_stream* s ); virtual ~log_stream_uniq(); virtual void write( const std::string& str ); virtual void flush(); private: void output_current_line(); private: /** \brief The stream in which the messages are finally written. */ log_stream* m_stream; /** \brief The current line to send into the stream. */ std::string m_current_line; /** \brief The previous line sent into the stream. */ std::string m_previous_line; /** \brief How many times the previous line has been repeated. */ std::size_t m_repetition_count; }; // class log_stream_uniq } // namespace claw #endif // __CLAW_LOG_STREAM_UNIQ_HPP__ libclaw-1.7.4/claw/logger.hpp000066400000000000000000000070601216507631600160700ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file logger.hpp * \brief Some basic classes for logging. * \author Julien Jorge */ #ifndef __CLAW_LOGGER_HPP__ #define __CLAW_LOGGER_HPP__ #include #include #include #include #include #ifndef CLAW_LOGGER_EXPORT # ifdef CLAW_LOGGER_NO_EXPORT # define CLAW_LOGGER_EXPORT # else # ifdef _WIN32 # ifdef claw_logger_EXPORTS # define CLAW_LOGGER_EXPORT __declspec(dllexport) # else # define CLAW_LOGGER_EXPORT __declspec(dllimport) # endif // def claw_logger_EXPORTS # else // def _WIN32 # define CLAW_LOGGER_EXPORT # endif // def _WIN32 # endif // def CLAW_LOGGER_NO_EXPORT #endif // ndef CLAW_LOGGER_EXPORT namespace claw { /** * \brief A class implementing a logging system. * * Messages are sent to the log system. If the importance (level) of a message * is lower or equal to a given threshold, the message is printed. Otherwise, * it is ignored. * * Message printing is managed by log_stream classes. The logger_system can * contain several log_stream. None checking is done when adding a log_stream * to see if it is already in the system. * * \author Julien Jorge */ class log_system { public: typedef log_stream stream_type; typedef std::list stream_list_type; public: CLAW_LOGGER_EXPORT log_system(); CLAW_LOGGER_EXPORT ~log_system(); CLAW_LOGGER_EXPORT void clear(); CLAW_LOGGER_EXPORT void merge( stream_type* s ); CLAW_LOGGER_EXPORT void remove( const stream_type* s ); CLAW_LOGGER_EXPORT void set( stream_type* s ); CLAW_LOGGER_EXPORT void set_level( int lvl ); CLAW_LOGGER_EXPORT void set_level( const log_level& lvl ); CLAW_LOGGER_EXPORT void flush(); template log_system& operator<<( const T& that ); CLAW_LOGGER_EXPORT log_system& operator<<( const log_level& that ); CLAW_LOGGER_EXPORT log_system& operator<<( log_system& (*pf)(log_system&) ); private: /** \brief The level of log. Messages are ignored if their level is greater than this level. */ int m_log_level; /** \brief The current message level, for operator << */ int m_message_level; /** \brief The streams in which we write de log informations. */ stream_list_type m_stream; }; // class log_system CLAW_LOGGER_EXPORT extern log_system logger; CLAW_LOGGER_EXPORT log_system& lendl(log_system& log); } // namespace claw namespace std { CLAW_LOGGER_EXPORT claw::log_system& endl( claw::log_system& log ); } // namespace std // template methods #include #endif // __CLAW_LOGGER_HPP__ libclaw-1.7.4/claw/lzw_decoder.hpp000066400000000000000000000056031216507631600171130ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file lzw_decoder.hpp * \brief A class to help decoding a stream encoded with Lempel-Ziv-Welch (LZW) * compression algorithm. * \author Julien Jorge */ #ifndef __CLAW_LZW_DECODER_HPP__ #define __CLAW_LZW_DECODER_HPP__ #include #include namespace claw { /** * \brief A class to help decoding a stream encoded with Lempel-Ziv-Welch * (LZW) compression algorithm. * *\b Template \b parameters: * - \a InputBuffer The type of the buffer where we read the compressed datas, * - \a OutputBuffer The type of the buffer where we write the uncompressed * datas. * * The \a InputBuffer type must have the following methods: * - bool end_of_data(), tell if the input buffer is empty, * - unsigned int symbols_count(), get the number of different symbols in the * uncompressed data, * - unsigned int get_next(), returns the next code and moves to the next * symbol. * * The \a OutputBuffer type must have the following methods: * - write( unsigned int ), write a symbol in the output. * * \author Julien Jorge */ template class lzw_decoder { public: /** \brief The type of the input buffer. */ typedef InputBuffer input_buffer_type; /** \brief The type of the output buffer. */ typedef OutputBuffer output_buffer_type; private: typedef std::pair word_type; typedef std::vector table_type; public: void decode( input_buffer_type& input, output_buffer_type& output ); private: unsigned int get_first_symbol ( const table_type& table, const unsigned int code, const unsigned int symbols_count ) const; void decompose ( const table_type& table, unsigned int code, const unsigned int symbols_count, output_buffer_type& output ) const; }; // class lzw_decoder } // namespace claw #include #endif // __CLAW_LZW_DECODER_HPP__ libclaw-1.7.4/claw/lzw_encoder.hpp000066400000000000000000000050641216507631600171260ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file lzw_encoder.hpp * \brief A class to help encoding a stream with Lempel-Ziv-Welch (LZW) * compression algorithm. * \author Julien Jorge */ #ifndef __CLAW_LZW_ENCODER_HPP__ #define __CLAW_LZW_ENCODER_HPP__ namespace claw { /** * \brief A class to help encoding a stream with Lempel-Ziv-Welch (LZW) * compression algorithm. * * \b Template \b parameters: * - \a InputBuffer The type of the input buffer (where we get raw data), * - \a OutputBuffer The type of the output buffer (where we write compressed * data). * * The \a InputBuffer type must have the following methods: * - bool end_of_data(), tell if the input buffer is empty, * - unsigned int symbols_count(), get the number of different symbols in the * uncompressed data, * - unsigned int get_next(), returns an unsigned integer representing the * next symbol and moves to the next symbol. * * The \a OutputBuffer type must have the following methods: * - unsigned int max_code(), get the highest code that the output buffer can * handle, * - write( unsigned int ), write a code in the output. * * \author Julien Jorge */ template class lzw_encoder { public: /** \brief The type of the input buffer. */ typedef InputBuffer input_buffer_type; /** \brief The type of the output buffer. */ typedef OutputBuffer output_buffer_type; public: void encode( input_buffer_type& input, output_buffer_type& output ) const; }; // class lzw_encoder } // namespace claw #include #endif // __CLAW_LZW_ENCODER_HPP__ libclaw-1.7.4/claw/math.hpp000066400000000000000000000023641216507631600155440ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file math.hpp * \brief Some mathematical structures and functions. * \author Julien Jorge */ #ifndef __CLAW_MATH_HPP__ #define __CLAW_MATH_HPP__ #include #include #include #include #include #endif // __CLAW_MATH_HPP__ libclaw-1.7.4/claw/max_vector.hpp000066400000000000000000000046561216507631600167700ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file max_vector.hpp * \brief Fill a container with some values, keeping only all the "maximum" * inserted values. * \author Julien Jorge */ #ifndef __CLAW_MAX_VECTOR_HPP__ #define __CLAW_MAX_VECTOR_HPP__ #include #include namespace claw { /** * \brief Fill a container with some values, keeping only all the "maximum" * inserted values. * * Adding a value greater than the previous ones remove all the old values. * * \b Template \b parameters: * - \param E: the type of the stored values. * - \param Comp: how to compare the old values with the new ones. * - \param Container: the type of the container in which the values are * stored. * * \author Julien Jorge */ template< typename E, typename Comp = std::less, typename Container = std::vector > class max_vector { public: /** \brief The type of the values stored in the container. */ typedef E value_type; /** \brief The comparator used to compare the values inserted. */ typedef Comp comparator_type; /** \brief The type of the container in which the values are stored. */ typedef Container container_type; public: max_vector(); explicit max_vector(const value_type& e); void add(const value_type& e); const container_type& get_v() const; private: /** \brief The maximum values. */ container_type m_values; }; // max_vector } // namespace claw #include #endif // __CLAW_MAX_VECTOR_HPP__ libclaw-1.7.4/claw/meta.hpp000066400000000000000000000026601216507631600155400ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file meta.hpp * \brief Structures for meta-programming. * \author Julien Jorge */ #ifdef __GNUC__ #warning "This header file is deprecated and will be removed in next release. Use the adequate file from claw/meta/ folder instead." #elif def _MSVC_VER #pragma message("This header file is deprecated and will be removed in next release. Use the adequate file from claw/meta/ folder instead.") #endif #include #include #include libclaw-1.7.4/claw/meta/000077500000000000000000000000001216507631600150235ustar00rootroot00000000000000libclaw-1.7.4/claw/meta/conditional.hpp000066400000000000000000000047041216507631600200440ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file conditional.hpp * \brief Structures for meta-programming. * \author Julien Jorge */ #ifndef __CLAW_CONDITIONAL_HPP__ #define __CLAW_CONDITIONAL_HPP__ namespace claw { namespace meta { /** * \brief This structure allows to do conditional typing. * * \b Template \b parameters * - \a Cond The result of the predicate to check. * - \a ThenPart The type defined when the predicate is true. * - \a ElsePart The type defined when the predicate is false. * * The result can be retrieved via the if_then_else::result type. * * \author Julien Jorge */ template struct if_then_else; /** * \brief Specialization for the case where the condition evaluates to * true. */ template struct if_then_else { /** \brief When the condition evaluates to true, the result is the "else" part. */ typedef ThenPart result; }; // struct if_then_else [true] /** * \brief Specialization for the case where the condition evaluates to * false. */ template struct if_then_else { /** \brief When the condition evaluates to false, the result is the "else" part. */ typedef ElsePart result; }; // struct if_then_else [false] } // namespace meta } // namespace claw #endif // __CLAW_CONDITIONAL_HPP__ libclaw-1.7.4/claw/meta/is_base_of.hpp000066400000000000000000000035271216507631600176340ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file is_base_of.hpp * \brief Check if a class is derived from an other class. * \author Julien Jorge */ #ifndef __CLAW_IS_BASE_OF_HPP__ #define __CLAW_IS_BASE_OF_HPP__ namespace claw { namespace meta { /** * \brief This predicate tells if a class is derived from an other class. * * \b Template \b parameters * - \a Base, the supposed base class, * - \a Derived, the derived type to check. * * The result can be retrieved via the is_base_of::result value. * * \author Julien Jorge */ template struct is_base_of { private: static Derived* m_d; private: static char check( Base* ); static long check( ... ); public: enum { result = ( sizeof(check( m_d )) == sizeof(char) ) }; }; // struct is_base_of [false] } // namespace meta } // namespace claw #endif // __CLAW_IS_BASE_OF_HPP__ libclaw-1.7.4/claw/meta/no_type.hpp000066400000000000000000000024041216507631600172110ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file no_type.hpp * \brief An empty class not considered as a effective type. * \author Julien Jorge */ #ifndef __CLAW_NO_TYPE_HPP__ #define __CLAW_NO_TYPE_HPP__ namespace claw { namespace meta { /** * \brief Empty type. */ struct no_type {}; } // namespace meta } // namespace claw #endif // __CLAW_NO_TYPE_HPP__ libclaw-1.7.4/claw/meta/same_type.hpp000066400000000000000000000033161216507631600175250ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file same_type.hpp * \brief Check if two types are the same. * \author Julien Jorge */ #ifndef __CLAW_SAME_TYPE_HPP__ #define __CLAW_SAME_TYPE_HPP__ namespace claw { namespace meta { /** * \brief This predicate tells if two types are the sames. * * \b Template \b parameters * - \a T, \a U The types to compare. * * The result can be retrieved via the same_type::result value. * * \author Julien Jorge */ template struct same_type { enum { result = false }; }; // struct same_type [false] template struct same_type { enum { result = true }; }; // struct same_type [true] } // namespace meta } // namespace claw #endif // __CLAW_SAME_TYPE_HPP__ libclaw-1.7.4/claw/meta/type_list.hpp000066400000000000000000000363341216507631600175610ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file type_list.hpp * \brief Template classes for lists of types. * \author Julien Jorge */ #ifndef __CLAW_TYPE_LIST_HPP__ #define __CLAW_TYPE_LIST_HPP__ #include #include #include namespace claw { namespace meta { /** * \brief Use this class to make a list of types. * * \b Template \b parameters * - \a Head The first type of the list. * - \a Queue A list of the remaining types. * * All type_list methods suppose that the list ends withe the type no_type. * * \b Example * * type_list< int, typelist > is a list of two * types. The last type (no_type) is used to indicate the end of * the list. * * \author Julien Jorge */ template struct type_list { /** \brief The first type in the list. */ typedef Head head_type; /** \brief The remaining types in the list. */ typedef Queue queue_type; }; // struct type_list /** * \brief Split a type_list according to the first instance of a given type. * * \b Template \b parameters * - \a Delimiter The type on which we split the list * - \a TypeList The type_list to split. */ template struct split_type_list_at; /** \brief Specialisation of split_type_list_at for an empty list or the case where the delimiter is no_type. */ template struct split_type_list_at { /** \brief There is no left part if there is no list. */ typedef no_type left_part_type; /** \brief There is no right part if there is no list. */ typedef no_type right_part_type; }; // struct split_type_list_at /** * \brief Split a type_list according to the first instance of a given type. * * \b Template \b parameters * - \a Delimiter The type on which we split the list * - \a TypeList The type_list to split. */ template struct split_type_list_at { /** \brief The left part of the list. The delimiter is not included. */ typedef typename if_then_else < same_type::result, no_type, /* delimiter is found, mark the end of the list. */ type_list /* otherwise, cut in the remaining types. */ < typename TypeList::head_type, typename split_type_list_at ::left_part_type > >::result left_part_type; /** \brief The right part of the list. The delimiter is included. */ typedef typename if_then_else < same_type::result, TypeList, /* delimiter is found, this is the right part. */ typename split_type_list_at ::right_part_type >::result right_part_type; }; // struct split_type_list_at /** * \brief A type list with a single type, more readable than an imbricated * type_list. */ template struct type_list_maker_1 { /** \brief The list described by this implementation. */ typedef type_list result; }; // struct type_list_maker_1 /** * \brief A type list with two types, more readable than an imbricated * type_list. */ template struct type_list_maker_2 { /** \brief The list described by this implementation. */ typedef type_list< T1, typename type_list_maker_1::result > result; }; // struct type_list_maker_2 /** * \brief A type list with three types, more readable than an imbricated * type_list. */ template struct type_list_maker_3 { /** \brief The list described by this implementation. */ typedef type_list< T1, typename type_list_maker_2::result > result; }; // struct type_list_maker_3 /** * \brief A type list with four types, more readable than an imbricated * type_list. */ template struct type_list_maker_4 { /** \brief The list described by this implementation. */ typedef type_list< T1, typename type_list_maker_3::result > result; }; // struct type_list_maker_4 /** * \brief A type list with five types, more readable than an imbricated * type_list. */ template struct type_list_maker_5 { /** \brief The list described by this implementation. */ typedef type_list < T1, typename type_list_maker_4::result > result; }; // struct type_list_maker_5 /** * \brief A type list with six types, more readable than an imbricated * type_list. */ template struct type_list_maker_6 { /** \brief The list described by this implementation. */ typedef type_list < T1, typename type_list_maker_5::result > result; }; // struct type_list_maker_6 /** * \brief A type list with seven types, more readable than an imbricated * type_list. */ template struct type_list_maker_7 { /** \brief The list described by this implementation. */ typedef type_list < T1, typename type_list_maker_6::result > result; }; // struct type_list_maker_7 /** * \brief A type list with height types, more readable than an imbricated * type_list. */ template struct type_list_maker_8 { /** \brief The list described by this implementation. */ typedef type_list < T1, typename type_list_maker_7::result > result; }; // struct type_list_maker_8 /** * \brief A type list with nine types, more readable than an imbricated * type_list. */ template struct type_list_maker_9 { /** \brief The list described by this implementation. */ typedef type_list < T1, typename type_list_maker_8 ::result > result; }; // struct type_list_maker_9 /** * \brief A type list with ten types, more readable than an imbricated * type_list. */ template struct type_list_maker_10 { /** \brief The list described by this implementation. */ typedef type_list < T1, typename type_list_maker_9 ::result > result; }; // struct type_list_maker_10 /** * \brief A type list with eleven types, more readable than an imbricated * type_list. */ template struct type_list_maker_11 { /** \brief The list described by this implementation. */ typedef type_list < T1, typename type_list_maker_10 ::result > result; }; // struct type_list_maker_11 /** * \brief A type list with twelve types, more readable than an imbricated * type_list. */ template struct type_list_maker_12 { /** \brief The list described by this implementation. */ typedef type_list < T1, typename type_list_maker_11 ::result > result; }; // struct type_list_maker_12 /** * \brief A type list with thirteen types, more readable than an imbricated * type_list. */ template struct type_list_maker_13 { /** \brief The list described by this implementation. */ typedef type_list < T1, typename type_list_maker_12 ::result > result; }; // struct type_list_maker_13 /** * \brief A type list with fourteen types, more readable than an imbricated * type_list. */ template struct type_list_maker_14 { /** \brief The list described by this implementation. */ typedef type_list < T1, typename type_list_maker_13 ::result > result; }; // struct type_list_maker_14 /** * \brief A type list with fifteen types, more readable than an imbricated * type_list. */ template struct type_list_maker_15 { /** \brief The list described by this implementation. */ typedef type_list < T1, typename type_list_maker_14 ::result > result; }; // struct type_list_maker_15 /** * \brief A type list with up to six types, more readable than an * imbricated type_list, more readable than type_list_maker_1 and * others. */ template< typename T1, typename T2 = no_type, typename T3 = no_type, typename T4 = no_type, typename T5 = no_type, typename T6 = no_type, typename T7 = no_type, typename T8 = no_type, typename T9 = no_type, typename T10 = no_type, typename T11 = no_type, typename T12 = no_type, typename T13 = no_type, typename T14 = no_type, typename T15 = no_type > struct type_list_maker { /** \brief The list described by this implementation. */ typedef typename split_type_list_at < no_type, typename type_list_maker_15 < T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 >::result >::left_part_type result; }; // struct type_list_maker /** * \brief Check if a type is present in a type_list. * * \b Template \b paramters * - \a T The type to find. * - \a List The list in which we search the type. * * \b Type \b requirements * - \a List is either no_type, either a type_list<> ended with no_type. * * \author Julien Jorge */ template struct type_list_find { enum { result = same_type::result || type_list_find::result }; }; // struct type_list_find template struct type_list_find { enum { result = same_type::result }; }; // struct type_list_find /** * \brief This class checks if each type in a type_list<> is present only * once. * * \author Julien Jorge */ template struct type_list_is_a_set { enum { result = !type_list_find::result && type_list_is_a_set::result }; }; // struct type_list_is_a_set template<> struct type_list_is_a_set { enum { result = true }; }; // struct type_list_is_a_set [no_type] /** * \brief This class computes the length of a list of types. * * \author Julien Jorge */ template struct type_list_length { enum { result = 1 + type_list_length::result }; }; // struct type_list_length template<> struct type_list_length { enum { result = 0 }; }; // struct type_list_length [no_type] /** * \brief Tell if a given type list contains a given type. * \param T The type to search. * \param List The list in which the type is searched. * * \author Julien Jorge */ template struct type_list_contains; template struct type_list_contains< T, type_list > { enum { result = true }; }; // struct type_list_contains template struct type_list_contains< T, no_type > { enum { result = false }; }; // struct type_list_contains template struct type_list_contains< T, type_list > { enum { result = type_list_contains::result }; }; // struct type_list_contains /** \brief The list of the types of the C++ language. */ typedef type_list_maker < signed char, unsigned char, signed short, unsigned short, signed int, unsigned int, signed long, unsigned long, #ifndef __STRICT_ANSI__ signed long long, unsigned long long, #endif float, double, long double, bool >::result cpp_type_list; } // namespace meta } // namespace claw #endif // __CLAW_TYPE_LIST_HPP__ libclaw-1.7.4/claw/multi_type_map.hpp000066400000000000000000000130151216507631600176360ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file multi_type_map.hpp * \brief This class can associate values of different types to a key. * \author Julien Jorge */ #ifndef __CLAW_MULTI_TYPE_MAP_HPP__ #define __CLAW_MULTI_TYPE_MAP_HPP__ #include #include #include namespace claw { /** * \brief This class provides types and methods to allow the call of methods * for a given type in the inheritance of a multi_type_map. * \remark This class is to be used internally. * * Suppose we have defined the following variable * * multi_type_map > > * my_map; * * The call int i = my_map.get( 24 ); doesn't match the type * of the end class. So the call is repercuted on the parent class until the * types match. Then, we can get the values in m_data. * * \b Template \b parameters * - \a ValueType is the type of the values on which the action is done. * - \a Map is the type of the map in which the action is done. * * \author Julien Jorge */ template class multi_type_map_wrapper; /** * \brief This class provides types and methods to allow the call of methods * recursively along the inherintance hierarchy. * \remark This class is to be used internally. */ template class multi_type_map_helper; /** * \brief This class can associate values of different types to a key. * * \b Template \b parameters * - \a Key The type to use for the keys. * - \a TypeList The list of the types that the map should support. * * \b Type \b requirements * - \a Key must be \a LessThanComparable. * - The last type in \a TypeList must be claw::meta::no_type. * - type_list_is_a_set::result == true * * \b Example * * multi_type_map > > * my_map; * * \author Julien Jorge */ template class multi_type_map; /** * \brief Partial specialization, to stop the inheritance recursivity. */ template class multi_type_map { }; // class multi_type_map /** * \brief This class can associate values of different types to a key. * \author Julien Jorge */ template class multi_type_map< Key, meta::type_list >: public multi_type_map { public: typedef Key key_type; typedef Head value_type; typedef meta::type_list value_type_list; typedef multi_type_map< Key, meta::type_list > self_type; typedef std::map container_type; typedef multi_type_map super; friend struct multi_type_map_wrapper; friend struct multi_type_map_helper; /** \brief This structure is used to create an iterator on the values of a given type. */ template struct iterator { /** \brief The type of the iterator. */ typedef typename std::map::iterator type; /** \brief The type of the const_iterator. */ typedef typename std::map::const_iterator const_type; }; // struct iterator private: typedef typename iterator::type iterator_type; typedef typename iterator::const_type const_iterator_type; public: template void erase( typename iterator::type it ); template std::size_t erase( const key_type& k ); template const ValueType& get( const key_type& k ) const; template ValueType& get( const key_type& k ); template void set( const key_type& k, const ValueType& v ); void set( const self_type& m ); template bool exists( const key_type& k ) const; std::size_t size() const; template typename iterator::type begin(); template typename iterator::type end(); template typename iterator::const_type begin() const; template typename iterator::const_type end() const; private: /** \brief Data stored for the first type of the list. */ container_type m_data; }; // class multi_type_map } // namespace claw #include #endif // __CLAW_MULTI_TYPE_MAP_HPP__ libclaw-1.7.4/claw/multi_type_map_visitor.hpp000066400000000000000000000033021216507631600214130ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file multi_type_map_visitor.hpp * \brief This class goes through all entries in a multi_type_map and apply a * function to them. * \author Julien Jorge */ #ifndef __CLAW_MULTI_TYPE_MAP_VISITOR_HPP__ #define __CLAW_MULTI_TYPE_MAP_VISITOR_HPP__ #include "claw/multi_type_map.hpp" namespace claw { /** * \brief This class goes through all entries in a multi_type_map and apply * a function to them. * \author Julien Jorge */ class multi_type_map_visitor { public: template void run( multi_type_map& m, Function f ) const; }; // class multi_type_map_visitor } // namespace claw #include "claw/impl/multi_type_map_visitor.tpp" #endif // __CLAW_MULTI_TYPE_MAP_VISITOR_HPP__ libclaw-1.7.4/claw/non_copyable.hpp000066400000000000000000000036721216507631600172660ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file non_copyable.hpp * \brief Inherit from this class to forbid copy constructor in your class. * \author Julien Jorge */ #ifndef __CLAW_NON_COPYABLE_HPP__ #define __CLAW_NON_COPYABLE_HPP__ namespace claw { namespace pattern { /** * \brief Inherit from this class to forbid construction of your class by * copy. * \author Julien Jorge */ class non_copyable { public: /** \brief Default constructor. */ non_copyable() {} private: /** * \brief Copy constructor is declared private and non implemented. * \param that Instance to copy from. */ non_copyable( const non_copyable& that ); /** * \brief Assignment operator is declared private and non implemented. * \param that Instance to copy from. */ non_copyable& operator=( const non_copyable& that ); }; // non_copyable } // namespace pattern namespace concept = pattern; } // namespace claw #endif // __CLAW_NON_COPYABLE_HPP__ libclaw-1.7.4/claw/ordered_set.hpp000066400000000000000000000057651216507631600171220ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file ordered_set.hpp * \brief A class to manage sets of ordered items. * \author Julien Jorge */ #ifndef __CLAW_ORDERED_SET_HPP__ #define __CLAW_ORDERED_SET_HPP__ #include namespace claw { namespace math { /** * \brief A class to manage sets of ordered items. * \author Julien Jorge */ template > class ordered_set: public avl { private: /** \brief The type of the parent class. */ typedef avl super; public: /** \brief The type of the iterator used to access non modifiable values. */ typedef typename super::const_iterator const_iterator; /** \brief The type of the values in the set. */ typedef typename super::value_type value_type; /** \brief The type passed to the template. */ typedef typename super::referent_type referent_type; /** \brief The type of a const reference on the values. */ typedef typename super::const_reference const_reference; public: ordered_set& operator*=( const ordered_set& that ); ordered_set& operator+=( const ordered_set& that ); ordered_set& operator-=( const ordered_set& that ); ordered_set& operator/=( const ordered_set& that ); bool operator>( const ordered_set& that ) const; bool operator>=( const ordered_set& that ) const; bool operator<( const ordered_set& that ) const; bool operator<=( const ordered_set& that ) const; ordered_set& intersection( const ordered_set& that ); ordered_set& join( const ordered_set& that ); ordered_set& difference( const ordered_set& that ); ordered_set& symetric_difference( const ordered_set& that ); bool contains( const ordered_set& that ) const; bool strictly_contains( const ordered_set& that ) const; private: /** \brief Function object used to compare keys. */ static Comp s_key_comp; }; // class ordered_set } // namespace math } // namespace claw #include #endif // __CLAW_ORDERED_SET_HPP__ libclaw-1.7.4/claw/osocket_stream.hpp000066400000000000000000000063001216507631600176270ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file osocket_stream.hpp * \brief A class to use any socket as a classic standard output stream. * \author Julien Jorge */ #ifndef __CLAW_OSOCKET_STREAM_HPP__ #define __CLAW_OSOCKET_STREAM_HPP__ #include #include namespace claw { namespace net { /** * \brief A class to use any socket as a classic standard output stream. * \author Julien Jorge */ template< typename CharT, typename Traits = std::char_traits > class basic_osocket_stream : public std::basic_ostream { public: /** \brief The type of the characters in the stream. */ typedef CharT char_type; /** \brief The traits carry some informations about the char_type. */ typedef Traits traits_type; /** \brief The type used to represent integers. */ typedef typename traits_type::int_type int_type; /** \brief The type used to represent a position in the stream. */ typedef typename traits_type::pos_type pos_type; /** \brief The type used to represent a delta in the positions. */ typedef typename traits_type::off_type off_type; /** \brief The type of the buffer manipulated by this stream. */ typedef basic_socketbuf buffer_type; private: /** \brief The type of the parent class. */ typedef std::basic_ostream super; public: basic_osocket_stream(); basic_osocket_stream( const std::string& address, int port ); ~basic_osocket_stream(); buffer_type* rdbuf() const; bool is_open() const; void open( const std::string& address, int port ); void open( int fd ); void close(); private: /** \brief The buffer used for output operations. */ buffer_type m_buffer; }; // class basic_osocket_stream /** \brief Implementation of the basic_osocket_stream for the char type. */ typedef basic_osocket_stream osocket_stream; /** \brief Implementation of the basic_osocket_stream for the wide characters. */ typedef basic_osocket_stream wosocket_stream; } // namespace net } // namespace claw #include #endif // __CLAW_OSOCKET_STREAM_HPP__ libclaw-1.7.4/claw/pcx.hpp000066400000000000000000000260121216507631600154010ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file pcx.hpp * \brief A class for pcx pictures. * \author Julien Jorge */ #ifndef __CLAW_PCX_HPP__ #define __CLAW_PCX_HPP__ #include #include #include #include #include #include #include namespace claw { namespace graphic { /** * \brief A class for pcx pictures. * \author Julien Jorge */ class pcx : public image { private: /* Some convenient renaming. */ typedef unsigned_integer_of_size<8>::type u_int_8; typedef unsigned_integer_of_size<16>::type u_int_16; typedef integer_of_size<8>::type int_8; typedef integer_of_size<16>::type int_16; enum format_version { v_2_5 = 0, v_2_8_with_palette = 2, v_2_8_without_palette = 3, v_win = 4, v_3_0 = 5 }; // enum format_version # pragma pack (push,1) /*--------------------------------------------------------------------*/ /** * \brief Header of a pcx file. */ class header { public: /** \brief Manufacturer (should be == 10). */ u_int_8 manufacturer; /** \brief Format version. */ u_int_8 version; /** \brief Tell if the file is encoded (RLE). */ u_int_8 encoded; /** \brief Number of bits per pixel. */ u_int_8 bpp; struct { /** \brief Minimum X-coordinate of the image. */ u_int_16 x_min; /** \brief Minimum Y-coordinate of the image. */ u_int_16 y_min; /** \brief Maximum X-coordinate of the image. */ u_int_16 x_max; /** \brief Maximum Y-coordinate of the image. */ u_int_16 y_max; } window; /** \brief Horizontal resolution of image in DPI. */ u_int_16 horizontal_dpi; /** \brief Vertical resolution of image in DPI. */ u_int_16 vertical_dpi; /** \brief Color map. */ rgb_pixel_8 color_map[16]; /** \brief Reserved. Should be set to zero. */ u_int_8 reserved; /** \brief Number of color planes. */ u_int_8 color_planes; /** \brief Number of bytes to allocate for a scanline plane. Must be an even number. */ u_int_16 bytes_per_line; /** \brief How to interpret the palette. */ u_int_16 palette_info; /** \brief Screen size in pixels. */ struct { /** \brief Horizontal screen size. */ u_int_16 horizontal; /** \brief Vertical screen size. */ u_int_16 vertical; } screen_size; /** \brief Zero bytes to fill the 128 bytes header. */ u_int_8 filler[54]; }; // struct header # pragma pack (pop) /*----------------------------------------------------------------------*/ /** \brief A color palette of RGBA colors. */ typedef color_palette color_palette32; /** \brief The type in which we store a scan line of a color plane. */ typedef std::vector color_plane_type; public: /*----------------------------------------------------------------------*/ /** * \brief This class read data from a pcx file and store it in an * image. * \author Julien Jorge */ class reader { private: /*--------------------------------------------------------------------*/ /** * \brief The type of the input buffer associated with the file when * decoding RLE files. */ typedef buffered_istream rle_pcx_input_buffer; /*--------------------------------------------------------------------*/ /** * \brief The output buffer for the RLE decoder. */ class rle_pcx_output_buffer { public: rle_pcx_output_buffer( color_plane_type& result ); void fill( unsigned int n, u_int_8 pattern ); void copy( unsigned int n, rle_pcx_input_buffer& buffer ); bool completed() const; private: /** \brief We save uncompressed in this buffer. */ color_plane_type& m_result; /** \brief Position of the next byte to write in m_result. */ unsigned int m_position; }; // class rle_pcx_output_buffer /*--------------------------------------------------------------------*/ /** * \brief RLE decoder for pcx RLE format */ class rle_pcx_decoder : public rle_decoder< u_int_8, rle_pcx_input_buffer, rle_pcx_output_buffer > { private: virtual void read_mode( input_buffer_type& input, output_buffer_type& output ); }; // class rle_pcx_decoder /*--------------------------------------------------------------------*/ /** * \brief Function object that converts a scanline of a monochrome pcx * into 32 bpp pixels. */ class converter_mono { public: void operator() ( const std::vector& scanline, image& img, unsigned int y ) const; }; // class converter_mono /*--------------------------------------------------------------------*/ /** * \brief Function object that converts a scanline of a 4bpp color * mapped pcx into 32 bpp pixels. */ class converter_16 { public: converter_16( const header& h ); void operator() ( const std::vector& scanline, image& img, unsigned int y ) const; private: /** \brief The header of the file. It contains the color palette. */ const header& m_header; }; // class converter_16 /*--------------------------------------------------------------------*/ /** * \brief Function object that converts a scanline of a 8bpp color * mapped pcx into 32 bpp pixels. */ class converter_256 { public: converter_256( const color_palette32& palette ); void operator() ( const std::vector& scanline, image& img, unsigned int y ) const; private: /** \brief The color palette. */ const color_palette32& m_palette; }; // class converter_256 /*--------------------------------------------------------------------*/ /** * \brief Function object that converts a scanline of a 3 planes true * color scanline into 32 bpp pixels. */ class converter_true_color { public: void operator() ( const std::vector& scanline, image& img, unsigned int y ) const; }; // class converter_true_color public: reader( image& img ); reader( image& img, std::istream& f ); void load( std::istream& f ); private: void check_if_pcx( const header& h ) const; void load_mono( const header& h, std::istream& f ); void load_16_color_mapped( const header& h, std::istream& f ); void load_true_color( const header& h, std::istream& f ); void load_256_color_mapped( const header& h, std::istream& f ); void decompress_line( std::istream& f, color_plane_type& scanline ) const; template void decompress ( const header& h, std::istream& f, const Converter& convert ); private: /** \brief The image in which we store the data we read. */ image& m_image; }; // class reader /*----------------------------------------------------------------------*/ /** * \brief This class write an image in a pcx file. * \author Julien Jorge */ class writer { public: /*--------------------------------------------------------------------*/ /** * \brief The type of the output buffer associated with the file when * encoding RLE data. */ class file_output_buffer { public: /** \brief The typ of the output patterns. */ typedef u_int_8 pattern_type; public: file_output_buffer( std::ostream& os ); void encode( unsigned int n, pattern_type pattern ); template void raw( Iterator first, Iterator last ); unsigned int min_interesting() const; unsigned int max_encodable() const; private: /** \brief The stream in which we write. */ std::ostream& m_stream; }; // class file_output_buffer /*--------------------------------------------------------------------*/ /** * \brief RLE encoder for pcx format * \author Julien Jorge */ typedef rle_encoder rle_pcx_encoder; public: writer( const image& img ); writer( const image& img, std::ostream& f ); void save( std::ostream& os ) const; private: void write_header ( std::ostream& os, unsigned int bytes_per_line ) const; void save_rle_true_color ( std::ostream& os, unsigned int bytes_per_line ) const; private: /** \brief The image from which we read the data. */ const image& m_image; }; // class writer public: pcx( unsigned int w, unsigned int h ); pcx( const image& that ); pcx( std::istream& f ); void save( std::ostream& os ) const; }; // class pcx } // namespace graphic } // namespace claw #include #include #endif // __CLAW_PCX_HPP__ libclaw-1.7.4/claw/pixel.hpp000066400000000000000000000100451216507631600157270ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file pixel.hpp * \brief Representation of a pixel in image processing. * \author Julien Jorge */ #ifndef __CLAW_PIXEL_HPP_ #define __CLAW_PIXEL_HPP_ #include namespace claw { namespace graphic { struct rgba_pixel; /** * \brief RGB pixel. */ struct rgb_pixel { /** \brief The type of the components of the color. */ typedef unsigned char component_type; /** \brief Component by component representation. */ struct { /** \brief Red component. */ component_type red; /** \brief Green component. */ component_type green; /** \brief Blue component. */ component_type blue; } components; public: rgb_pixel(); rgb_pixel( component_type r, component_type g, component_type b ); rgb_pixel( const rgba_pixel& p ); explicit rgb_pixel( const std::string& c ); bool operator==(const rgb_pixel& that) const; bool operator==(const rgba_pixel& that) const; bool operator!=(const rgb_pixel& that) const; bool operator!=(const rgba_pixel& that) const; }; // struct rgb_pixel /** * \brief RGBA pixel. */ struct rgba_pixel { /** \brief The type of the components of the color. */ typedef unsigned char component_type; union { /** \brief Compressed representation. */ unsigned int pixel; /** \brief Component by component representation. */ struct { /** \brief Red component. */ component_type red; /** \brief Green component. */ component_type green; /** \brief Blue component. */ component_type blue; /** \brief Translucy. */ component_type alpha; } components; }; public: rgba_pixel(); rgba_pixel( const rgb_pixel& that ); rgba_pixel( component_type r, component_type g, component_type b, component_type a ); explicit rgba_pixel( const std::string& c ); rgba_pixel& operator=( const rgb_pixel& that ); bool operator==( const rgba_pixel& that ) const; bool operator!=( const rgba_pixel& that ) const; component_type luminosity() const; }; // struct rgba_pixel /** \brief A color with 8 bits per component. */ typedef rgb_pixel rgb_pixel_8; /** \brief A color with 8 bits per component and an alpha channel. */ typedef rgba_pixel rgba_pixel_8; /** \defgroup Colors Colors. * \{ */ /** \brief A transparent color. */ extern rgba_pixel transparent_pixel; /** \brief The black color. */ extern rgba_pixel black_pixel; /** \brief The white color. */ extern rgba_pixel white_pixel; /** \brief The blue color. */ extern rgba_pixel blue_pixel; /** \brief The green color. */ extern rgba_pixel green_pixel; /** \brief The red color. */ extern rgba_pixel red_pixel; /** \brief The yellow color. */ extern rgba_pixel yellow_pixel; /** \brief The magenta color. */ extern rgba_pixel magenta_pixel; /** \brief The cyan color. */ extern rgba_pixel cyan_pixel; /** \} */ } // namespace graphic } // namespace claw #endif // __CLAW_PIXEL_HPP__ libclaw-1.7.4/claw/png.hpp000066400000000000000000000150141216507631600153730ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file png.hpp * \brief A class for png pictures. * \author Julien Jorge */ #ifndef __CLAW_PNG_HPP__ #define __CLAW_PNG_HPP__ #include #include #include #include #include #include namespace claw { namespace graphic { /** * \brief A class for png pictures. * \author Julien Jorge */ class png : public image { public: /*----------------------------------------------------------------------*/ /** * \brief This class read data from a png file and store it in an image. * \author Julien Jorge */ class reader { // classes that need to be accessible from png callbacks. public: /*--------------------------------------------------------------------*/ /** * \brief Source manager that allow us to read from a std::istream. * \author Julien Jorge */ struct source_manager { public: source_manager( std::istream& is ); void read( png_bytep data, png_size_t length ); private: /** \brief The stream from which we get data. */ std::istream& m_input; }; // struct source_manager public: reader( image& img ); reader( image& img, std::istream& f ); void load( std::istream& f ); private: void read_from_file( std::istream& f ); void check_if_png( png_structp png_ptr, std::istream& f ) const; void read_image( png_structp png_ptr, png_infop info_ptr ); void read_sequential_image( png_structp png_ptr, png_infop info_ptr ); void read_interlaced_image( png_structp png_ptr, png_infop info_ptr, unsigned int passes ); void copy_pixel_line ( png_byte color_type, png_bytep data, unsigned int y ); void create_read_structures( png_structp& png_ptr, png_infop& info_ptr ) const; private: /** \brief The image in which we store the data we read. */ image& m_image; /** \brief Size, in bytes, of a red/green/blue/alpha pixel in a png file. */ static const unsigned int s_rgba_pixel_size; }; // class reader /*----------------------------------------------------------------------*/ /** * \brief This class write an image in a png file. * \author Julien Jorge */ class writer { public: /** * \brief Parameters of the writing algorithm. */ struct options { public: /** \brief Compression level in the interlaced image. */ enum compression_level { no_compression = Z_NO_COMPRESSION, best_speed = Z_BEST_SPEED, best_compression = Z_BEST_COMPRESSION, default_compression = Z_DEFAULT_COMPRESSION }; // enum compression_level /** \brief The algorithm to use to interlace the saved image. */ enum interlace_type { /** \brief Saved image won't be interaced. */ none = PNG_INTERLACE_NONE, /** \brief Saved image will be interlaced using the Adam7 algorithm. */ adam7 = PNG_INTERLACE_ADAM7 }; // enum interlace_type public: options(); options( compression_level compression_level_, interlace_type interlace_ ); public: /** \brief Compression level to use in the saved stream. */ compression_level compression; /** \brief Interlace method to apply to the saved image. */ interlace_type interlace; }; // struct options // classes that need to be accessible from png callbacks. /*--------------------------------------------------------------------*/ /** * \brief Target manager that allow us to write in a std::ostream. * \author Julien Jorge */ struct target_manager { public: target_manager( std::ostream& os ); void write( png_bytep data, png_size_t length ); void flush(); private: /** \brief The stream in which we write the data. */ std::ostream& m_output; }; // struct target_manager public: writer( const image& img ); writer( const image& img, std::ostream& f, const options& opt = options() ); void save( std::ostream& f, const options& opt = options() ) const; private: void set_options( png_structp png_ptr, png_infop info_ptr, const options& opt ) const; void save_image( png_structp png_ptr, png_infop info_ptr ) const; void copy_pixel_line( png_bytep data, unsigned int y ) const; void create_write_structures( png_structp& png_ptr, png_infop& info_ptr ) const; private: /** \brief The image from which we thake the data to save. */ const image& m_image; /** \brief Size, in bytes, of a red/green/blue/alpha pixel in a png file. */ static const unsigned int s_rgba_pixel_size; }; // class writer public: png( unsigned int w, unsigned int h ); png( const image& that ); png( std::istream& f ); void save( std::ostream& os, const writer::options& opt = writer::options() ) const; }; // class png } // namespace graphic } // namespace claw #endif // __CLAW_PNG_HPP__ libclaw-1.7.4/claw/real_number.hpp000066400000000000000000000074461216507631600171140ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/real_number.hpp * \brief Custom precision real numbers. * \author Julien Jorge */ #ifndef __CLAW_REAL_NUMBER_HPP__ #define __CLAW_REAL_NUMBER_HPP__ #include #include namespace claw { template class real_number; } template std::istream& operator>>( std::istream& is, claw::real_number& self ); namespace claw { /** * \brief This class generates an epsilon value of a given precision. * \author Julien Jorge */ template struct make_epsilon { static T value( T v ) { return std::abs(v) <= 1 ? std::numeric_limits::epsilon() : std::abs(v) * std::numeric_limits::epsilon(); } }; // struct make_epsilon /** * \brief Custom precision real numbers. * \author Julien Jorge */ template class real_number { friend std::istream& ::operator>> <>( std::istream& is, real_number& self ); public: typedef T value_type; typedef real_number self_type; public: real_number(); real_number( const value_type& v ); real_number( const self_type& that ); self_type abs() const; bool operator<( const self_type& that ) const; bool operator<=( const self_type& that ) const; bool operator>( const self_type& that ) const; bool operator>=( const self_type& that ) const; bool operator==( const self_type& that ) const; bool operator!=( const self_type& that ) const; self_type operator+( const self_type& that ) const; self_type operator-( const self_type& that ) const; self_type operator*( const self_type& that ) const; self_type operator/( const self_type& that ) const; self_type& operator+=( const self_type& that ); self_type& operator-=( const self_type& that ); self_type& operator*=( const self_type& that ); self_type& operator/=( const self_type& that ); std::ostream& output( std::ostream& os ) const; template operator U() const; private: /** \brief The value of the number. */ value_type m_value; /** \brief Precision applied to operators. */ value_type m_epsilon; }; // class real_number } // namespace claw namespace std { template struct numeric_limits< claw::real_number >: public numeric_limits { }; // struct numeric_limits template claw::real_number abs( const claw::real_number& v ); } // namespace std // unary minus template claw::real_number operator-( const claw::real_number& self ); template claw::real_number operator-( T v, const claw::real_number& self ); template std::ostream& operator<<( std::ostream& os, const claw::real_number& self ); template std::istream& operator>>( std::istream& is, claw::real_number& self ); #include "claw/impl/real_number.tpp" #endif // __CLAW_REAL_NUMBER_HPP__ libclaw-1.7.4/claw/rectangle.hpp000066400000000000000000000070701216507631600165560ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file rectangle.hpp * \brief A class representing a rectangle by his x,y coordinates, width and * height. * \author Julien Jorge */ #ifndef __CLAW_RECTANGLE_HPP__ #define __CLAW_RECTANGLE_HPP__ #include #include namespace claw { namespace math { /** * \brief A class representing a rectangle by his x,y coordinates, width and * height. * * This class considers that the y-axis increases from the top to the bottom * (like a screen). * * \author Julien Jorge */ template class rectangle { public: /** \brief The type of the values we store. */ typedef T value_type; /** \brief The type of the current class. */ typedef rectangle self_type; public: rectangle(); template rectangle( const rectangle& that ); template rectangle( const box_2d& that ); rectangle( const value_type& _x, const value_type& _y, const value_type& _width, const value_type& _height); template rectangle( const coordinate_2d& pos, const value_type& _width, const value_type& _height ); template rectangle( const coordinate_2d& pos, const coordinate_2d& size ); template rectangle cast_value_type_to() const; bool operator==( const self_type& that ) const; bool operator!=( const self_type& that ) const; value_type area() const; bool includes( const coordinate_2d& p ) const; bool includes( const self_type& r ) const; bool intersects( const self_type& r ) const; self_type intersection( const self_type& r ) const; self_type join( const self_type& r ) const; void set( const value_type& new_x, const value_type& new_y, const value_type& new_width, const value_type& new_height ); value_type left() const; value_type right() const; value_type bottom() const; value_type top() const; coordinate_2d size() const; private: void x_intersection( const self_type& r, self_type& result ) const; void y_intersection( const self_type& r, self_type& result ) const; public: /** \brief value_typeop left coordinates. */ coordinate_2d position; /** \brief Width. */ value_type width; /** \brief Height. */ value_type height; }; // class rectangle } // namespace math } // namespace claw #include #endif // __CLAW_RECTANGLE_HPP__ libclaw-1.7.4/claw/rle_decoder.hpp000066400000000000000000000063231216507631600170610ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file rle_decoder.hpp * \brief A class to help decoding run-length encoded (RLE) streams. * \author Julien Jorge */ #ifndef __CLAW_RLE_DECODER_HPP__ #define __CLAW_RLE_DECODER_HPP__ namespace claw { /** * \brief A class to help decoding run-length encoded (RLE) streams. * *\b Template \b parameters : * - \a Pattern The type of the patterns in the coded stream, * - \a InputBuffer The type of the input buffer, * - \a OutputBuffer The type of the output buffer. * * The \a Pattern and \a InputBuffer parameters don't have any type * requirement. * * The \a OutputBuffer type must have the following methods : * - fill( unsigned int n, Pattern pattern ), copy n times the pattern, * - copy( unsigned int n, InputBuffer input ), copy n patterns directly from * the input buffer. * * \author Julien Jorge */ template< typename Pattern, typename InputBuffer, typename OutputBuffer > class rle_decoder { public: /** \brief The type of the patterns we will read in the input buffer. */ typedef Pattern pattern_type; /** \brief The type of the input buffer. */ typedef InputBuffer input_buffer_type; /** \brief The type of the output buffer. */ typedef OutputBuffer output_buffer_type; protected: /** * \brief State of the decompression. */ enum mode { /** \brief Stop the decoding. */ stop, /** \brief Next bytes represent raw data. */ raw, /** \brief Next bytes represent compressed data. */ compressed }; // enum mode public: rle_decoder(); virtual ~rle_decoder(); void decode( input_buffer_type& input, output_buffer_type& output ); protected: virtual void read_mode( input_buffer_type& input, output_buffer_type& output ) = 0; protected: /** \brief Current mode of the decompression. */ mode m_mode; /** * \brief Case of m_mode : * - m_mode == raw : The number of the next raw patterns, * - m_mode == compressed : How many times the pattern is repeated. */ unsigned int m_count; /** \brief The pattern to repeat. */ pattern_type m_pattern; }; // class rle_decoder } // namespace claw #include #endif // __CLAW_RLE_DECODER_HPP__ libclaw-1.7.4/claw/rle_encoder.hpp000066400000000000000000000051231216507631600170700ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file rle_encoder.hpp * \brief A class to help run-length encoding (RLE) streams. * \author Julien Jorge */ #ifndef __CLAW_RLE_ENCODER_HPP__ #define __CLAW_RLE_ENCODER_HPP__ #include namespace claw { /** * \brief A class to help run-length encoding (RLE) streams. * *\b Template \b parameters : * - \a OutputBuffer The type of the output buffer. * * The \a OutputBuffer type must have the following typedefs : * - pattern_type, the type of the stored data. * * The \a OutputBuffer type must have the following methods : * - encode( unsigned int n, pattern_type pattern ), code n times the * pattern ; * - template raw( Iterator first, Iterator last ) ; * - unsigned int min_interesting() returns the minimum number of time we must * have the same value before compressing it ; * - unsigned int max_encodable() return the maximum number of time we can * have the same value before compressing it. * * \author Julien Jorge */ template class rle_encoder { public: /** \brief The type of the output buffer. */ typedef OutputBuffer output_buffer_type; /** \brief The type of the stored data. */ typedef typename output_buffer_type::pattern_type pattern_type; private: /** \brief The type of the buffer on which we store the raw data. */ typedef std::list raw_buffer_type; public: template void encode( Iterator first, Iterator last, output_buffer_type& output ) const; }; // class rle_encoder } // namespace claw #include #endif // __CLAW_RLE_ENCODER_HPP__ libclaw-1.7.4/claw/smart_ptr.hpp000066400000000000000000000062111216507631600166210ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file smart_ptr.hpp * \brief A pointer with a reference counter. * \author Julien Jorge */ #ifndef __CLAW_SMART_PTR_HPP__ #define __CLAW_SMART_PTR_HPP__ namespace claw { namespace memory { /** * \brief A pointer with a reference counter. * * Smart pointers allow the user to stop caring about the release of * dynamically allocated memory. When no more pointers point to the * allocated memory, this memory is released. * * \b Template \b parameters: * - \a T The type of the pointed data. * * \author Julien Jorge */ template class smart_ptr { public: /** \brief The type of the pointed data. */ typedef T value_type; /** \brief The type of the current class. */ typedef smart_ptr self_type; /** \brief Reference on the type of the stored data. */ typedef T& reference; /** \brief Pointer on the type of the stored data. */ typedef T* pointer; /** \brief Constant reference on the type of the stored data. */ typedef const T& const_reference; /** \brief Constant pointer on the type of the stored data. */ typedef const T* const const_pointer; public: smart_ptr(); smart_ptr( pointer data ); smart_ptr( const self_type& that ); ~smart_ptr(); self_type& operator=( const self_type& that ); bool operator==( const self_type& that ) const; bool operator!=( const self_type& that ) const; bool operator<( const self_type& that ) const; bool operator<=( const self_type& that ) const; bool operator>( const self_type& that ) const; bool operator>=( const self_type& that ) const; pointer operator->(); pointer operator->() const; reference operator*(); reference operator*() const; private: void copy( const self_type& that ); void release(); private: /** \brief Number of smart_ptr pointing on this memory area. */ unsigned int* m_ref_count; /** \brief The pointed item. */ pointer m_ptr; }; // class smart_ptr } // namespace memory } // namespace claw #include #endif // __CLAW_SMART_PTR_HPP__ libclaw-1.7.4/claw/socket_server.hpp000066400000000000000000000042551216507631600174720ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file socket_server.hpp * \brief Class used to receive incoming connections. * \author Julien Jorge */ #ifndef __CLAW_SOCKET_SERVER_HPP__ #define __CLAW_SOCKET_SERVER_HPP__ #include #include #include #include #include namespace claw { namespace net { /** * \brief Class used to receive incoming connections. * \author Julien Jorge */ class socket_server : private basic_socket { public: socket_server(); socket_server( int port, unsigned int queue_size = s_default_queue_size ); socket_server* open( int port, unsigned int queue_size = s_default_queue_size ); socket_server* close(); bool is_open() const; operator bool() const; template void accept( SocketStream& sock, int time_limit ); static bool init(); static bool release(); private: /** \brief Default queue size for calls to listen. */ static const unsigned int s_default_queue_size = 16; }; // class socket_server } // namespace net } // namespace claw #include #endif // __CLAW_SOCKET_SERVER_HPP__ libclaw-1.7.4/claw/socket_stream.hpp000066400000000000000000000061741216507631600174610ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file socket_stream.hpp * \brief A class to use any socket as a classic standard stream. * \author Julien Jorge */ #ifndef __CLAW_SOCKET_STREAM_HPP__ #define __CLAW_SOCKET_STREAM_HPP__ #include #include namespace claw { namespace net { /** * \brief A class to use any socket as a classic standard stream. * \author Julien Jorge */ template< typename CharT, typename Traits = std::char_traits > class basic_socket_stream : public std::basic_iostream { public: /** \brief The type of the characters in the stream. */ typedef CharT char_type; /** \brief The traits carry some informations about the char_type. */ typedef Traits traits_type; /** \brief The type used to represent integers. */ typedef typename traits_type::int_type int_type; /** \brief The type used to represent a position in the stream. */ typedef typename traits_type::pos_type pos_type; /** \brief The type used to represent a delta in the positions. */ typedef typename traits_type::off_type off_type; /** \brief The type of the buffer manipulated by this stream. */ typedef basic_socketbuf buffer_type; public: explicit basic_socket_stream( int read_delay = -1 ); basic_socket_stream( const char* address, int port, int read_delay = -1 ); ~basic_socket_stream(); buffer_type* rdbuf() const; bool is_open() const; void set_read_time_limit( int read_limit ); void open( const char* address, int port ); void open( int fd ); void close(); private: /** \brief The buffer used for operations. */ buffer_type m_buffer; }; // class basic_socket_stream /** \brief Implementation of the basic_socket_stream for the char type. */ typedef basic_socket_stream socket_stream; /** \brief Implementation of the basic_socket_stream for the wide characters. */ typedef basic_socket_stream wsocket_stream; } // namespace net } // namespace claw #include #endif // __CLAW_SOCKET_STREAM_HPP__ libclaw-1.7.4/claw/socket_traits.hpp000066400000000000000000000047021216507631600174670ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file socket_traits.hpp * \brief Include the good interface for sockets for your system. * \author Julien Jorge */ #ifndef __CLAW_SOCKET_TRAITS_HPP__ #define __CLAW_SOCKET_TRAITS_HPP__ /** * \class claw::net::socket_traits * * \brief Common interface for platform specific methods needed for using * sockets. * * The claw::net::socket_traits implements platform specific methods for * socket usage through a common interface. This interface must include : * - a type named \c handle, representing the system handle to a library, * - a method handle open(std::string) for opening a library. This * method can throw an exception if a problem occurs, * - a method handle auto_open(std::string) for opening the current * program. the string will be the name (path) of the current program. This * method can throw an exception if a problem occurs, * - a method void close(handle) for closing a library, * - a method implementation_defined_pointer * get_symbol(handle, std::string) for getting a pointer to a symbol of * the library, * - a methof bool have_symbol(handle, std::string) saying if a * library has a specific symbol, * - a method bool valid_handle(handle) which tell if an handle * represent a valid handle. * * All these methods must be defined as static . */ #ifdef _WIN32 #include #else #include #endif #endif // __CLAW_DYNAMIC_LIBRARY_TRAITS_HPP__ libclaw-1.7.4/claw/socket_traits_unix.hpp000066400000000000000000000153541216507631600205370ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file socket_traits_unix.hpp * \brief Unix interface for using sockets. * \author Julien Jorge */ #ifndef __CLAW_SOCKET_TRAITS_UNIX_HPP__ #define __CLAW_SOCKET_TRAITS_UNIX_HPP__ #include #include #include #include #include #include #include #include #include namespace claw { /** * \brief Unix interface for using sockets. * \author Julien Jorge */ class socket_traits_unix { public: /** \brief Type of the system description of the socket. */ typedef int descriptor; public: /** \brief Invalid socket descriptor. */ static const descriptor invalid_socket = -1; public: /*------------------------------------------------------------------------*/ /** * \brief Initialize the use of the socket library. * \return true if the initialization is successful. */ static bool init() { return true; } // socket_traits_unix::init() /*------------------------------------------------------------------------*/ /** * \brief Close the socket library. * \return true if the operation is successful. */ static bool release() { return true; } // socket_traits_unix::release() /*------------------------------------------------------------------------*/ /** * \brief Open a socket. * \return The descriptor on the loaded socket. */ static descriptor open() { descriptor fd = invalid_socket; fd = socket(AF_INET, SOCK_STREAM, 0); return fd; } // socket_traits_unix::open() /*------------------------------------------------------------------------*/ /** * \brief Close a socket. * \param d The descriptor of the socket to close. * \return true if the socket has been closed. */ static bool close( descriptor d ) { return ::close(d) == 0; } // socket_traits_unix::close() /*------------------------------------------------------------------------*/ /** * \brief Connect a socket to a port. * \param d The descriptor of the socket to connect. * \param address The adress to connect to. * \param port The port to connect to. * \return true if the connection is available. */ static bool connect( descriptor d, const std::string& address, int port ) { CLAW_PRECOND( d != invalid_socket ); bool result = false; struct hostent* hp = gethostbyname(address.c_str()); if (hp) { struct sockaddr_in sa; memset (&sa, '\0', sizeof(sa)); sa.sin_family = hp->h_addrtype; sa.sin_port = htons(port); memcpy( &sa.sin_addr, hp->h_addr, hp->h_length ); if (::connect(d, (struct sockaddr*)&sa, (socklen_t)sizeof(sa)) != -1) result = true; } return result; } // socket_traits_unix::connect() /*------------------------------------------------------------------------*/ /** * \brief Open a socket for incoming connexions. * \param d The descriptor of the socket to open. * \param port The port to connect to. * \param queue_size The size of the queue for incoming connexions. * \return true if the socket has been opened. */ static bool listen( descriptor d, int port, unsigned int queue_size ) { CLAW_PRECOND( d != invalid_socket ); struct sockaddr_in addr; memset (&addr, '\0', sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = htonl(INADDR_ANY); if ( bind(d, (struct sockaddr*)&addr, sizeof(addr)) != -1 ) return ::listen(d, queue_size) != -1; else return false; } // socket_traits_unix::listen() /*------------------------------------------------------------------------*/ /** * \brief Select a socket for reading. * \param d The descriptor of the socket to read. * \param time_limit Maximum of seconds to wait before considering there's * nothing to read. If \a time_limit is negative, the method wait * until there is something to read. * \return true if the socket is ready to be read. */ static bool select_read( descriptor d, int time_limit = -1 ) { CLAW_PRECOND( d != invalid_socket ); struct timeval tv, *ptv; fd_set fds; if ( time_limit < 0 ) ptv = NULL; else { tv.tv_sec = time_limit; tv.tv_usec = 0; ptv = &tv; } FD_ZERO(&fds); FD_SET(d, &fds); select( d+1, &fds, NULL, NULL, ptv ); return FD_ISSET( d, &fds ); } // socket_traits_unix::select_read() /*------------------------------------------------------------------------*/ /** * \brief Accept an incoming connexion. * \param d The descriptor of the socket to listen. * \return The descriptor of the incoming connexion. */ static descriptor accept( descriptor d ) { return ::accept( d, NULL, NULL ); } // socket_traits_unix::accept() /*------------------------------------------------------------------------*/ /** * \brief Tell if a descriptor is a valid socket descriptor. * \param d The descriptor to test. */ static bool valid_descriptor( descriptor d ) { return d != invalid_socket; } // socket_traits_unix::valid_descriptor() /*------------------------------------------------------------------------*/ /** * \brief Tell if a descriptor is a opened socket. * \param d The descriptor to test. */ static bool is_open( descriptor d ) { struct stat buf; return fstat(d, &buf) == 0; } // socket_traits_unix::is_open() }; // class socket_traits_unix typedef socket_traits_unix socket_traits; } // namespace claw #endif // __CLAW_SOCKET_TRAITS_UNIX_HPP__ libclaw-1.7.4/claw/socket_traits_win32.hpp000066400000000000000000000154661216507631600205220ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file socket_traits_win32.hpp * \brief Win32 interface for using sockets. * \author Julien Jorge */ #ifndef __CLAW_SOCKET_TRAITS_WIN32_HPP__ #define __CLAW_SOCKET_TRAITS_WIN32_HPP__ #include #include #include #include #include namespace claw { /** * \brief Win32 interface for using sockets. * \author Julien Jorge */ class socket_traits_win32 { public: /** \brief Type of the system description of the socket. */ typedef SOCKET descriptor; public: /** \brief Invalid socket descriptor. */ static const descriptor invalid_socket = INVALID_SOCKET; public: /*------------------------------------------------------------------------*/ /** * \brief Initialize the use of the socket library. * \return true if the initialization is successful. */ static bool init() { WORD version; WSADATA data; version = MAKEWORD( 2, 2 ); return WSAStartup( version, &data ) == 0; } // socket_traits_win32::init() /*------------------------------------------------------------------------*/ /** * \brief Close the socket library. * \return true if the operation is successful. */ static bool release() { return WSACleanup() == 0; } // socket_traits_win32::release() /*------------------------------------------------------------------------*/ /** * \brief Open a socket. * \return The descriptor on the loaded socket. */ static descriptor open() { descriptor fd = invalid_socket; fd = socket(AF_INET, SOCK_STREAM, 0); return fd; } // socket_traits_win32::open() /*------------------------------------------------------------------------*/ /** * \brief Close a socket. * \param d The descriptor of the socket to close. * \return true if the socket has been closed. */ static bool close( descriptor d ) { return ::closesocket(d) == 0; } // socket_traits_win32::close() /*------------------------------------------------------------------------*/ /** * \brief Connect a socket to a port. * \param d The descriptor of the socket to connect. * \param address The adress to connect to. * \param port The port to connect to. * \return true if the connection is available. */ static bool connect( descriptor d, const std::string& address, int port ) { CLAW_PRECOND( d != invalid_socket ); bool result=false; struct hostent* hp = gethostbyname(address.c_str()); if (hp) { struct sockaddr_in sa; memset (&sa, '\0', sizeof(sa)); sa.sin_family = hp->h_addrtype; sa.sin_port = htons(port); memcpy( &sa.sin_addr, hp->h_addr, hp->h_length ); if ( ::connect(d, (struct sockaddr*)&sa, sizeof(sa)) != SOCKET_ERROR ) result = true; } return result; } // socket_traits_win32::connect() /*------------------------------------------------------------------------*/ /** * \brief Open a socket for incoming connexions. * \param d The descriptor of the socket to open. * \param port The port to connect to. * \param queue_size The size of the queue for incoming connexions. * \return true if the socket has been opened. */ static bool listen( descriptor d, int port, unsigned int queue_size ) { CLAW_PRECOND( d != invalid_socket ); struct sockaddr_in addr; memset (&addr, '\0', sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = htonl(INADDR_ANY); if ( bind(d, (struct sockaddr*)&addr, sizeof(addr)) != SOCKET_ERROR ) return ::listen(d, queue_size) != SOCKET_ERROR; else return false; } // socket_traits_win32::connect() /*------------------------------------------------------------------------*/ /** * \brief Select a socket for reading. * \param d The descriptor of the socket to read. * \param time_limit Maximum of seconds to wait before considering there's * nothing to read. If \a time_limit is negative, the method wait * until there is something to read. * \return true if the socket is ready to be read. */ static bool select_read( descriptor d, int time_limit = -1 ) { CLAW_PRECOND( d != invalid_socket ); struct timeval tv, *ptv; fd_set fds; if ( time_limit < 0 ) ptv = NULL; else { tv.tv_sec = time_limit; tv.tv_usec = 0; ptv = &tv; } FD_ZERO(&fds); FD_SET(d, &fds); select( d+1, &fds, NULL, NULL, ptv ); return FD_ISSET( d, &fds ); } // socket_traits_win32::select_read() /*------------------------------------------------------------------------*/ /** * \brief Accept an incoming connexion. * \param d The descriptor of the socket to listen. * \return The descriptor of the incoming connexion. */ static descriptor accept( descriptor d ) { return ::accept( d, NULL, NULL ); } // socket_traits_win32::accept() /*------------------------------------------------------------------------*/ /** * \brief Tell if a descriptor is a valid socket descriptor. * \param d The descriptor to test. */ static bool valid_descriptor( descriptor d ) { return d != invalid_socket; } // socket_traits_win32::valid_descriptor() /*------------------------------------------------------------------------*/ /** * \brief Tell if a descriptor is a opened socket. * \param d The descriptor to test. */ static bool is_open( descriptor d ) { return valid_descriptor(d); } // socket_traits_win32::is_open() }; // class socket_traits_win32 typedef socket_traits_win32 socket_traits; } // namespace claw #endif // __CLAW_SOCKET_TRAITS_WIN32_HPP__ libclaw-1.7.4/claw/string_algorithm.hpp000066400000000000000000000064641216507631600201740ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file string_algorithm.hpp * \brief Generic algorithms on strings. * \author Julien Jorge */ #ifndef __CLAW_STRING_ALGORITHM_HPP__ #define __CLAW_STRING_ALGORITHM_HPP__ #include namespace claw { namespace text { template StreamType& getline( StreamType& is, StringType& str ); template void trim_left( StringType& str, const typename StringType::value_type* const s = " " ); template void trim_right( StringType& str, const typename StringType::value_type* const s = " " ); template void trim( StringType& str, const typename StringType::value_type* const s = " " ); template void squeeze( StringType& str, const typename StringType::value_type* const s ); template std::size_t replace( StringType& str, const StringType& e1, const StringType& e2 ); template bool is_of_type( const StringType& str ); template void split ( Sequence& sequence, const typename Sequence::value_type& str, const typename Sequence::value_type::value_type sep ); template void split ( Sequence& sequence, typename Sequence::value_type::const_iterator first, typename Sequence::value_type::const_iterator last, const typename Sequence::value_type::value_type sep ); template void c_escape ( InputIterator first, InputIterator last, OutputIterator out ); template bool glob_match( const StringType& pattern, const StringType& text, const typename StringType::value_type any_sequence = '*', const typename StringType::value_type zero_or_one = '?', const typename StringType::value_type any = '.' ); template bool glob_potential_match ( const StringType& pattern, const StringType& text, const typename StringType::value_type any_sequence = '*', const typename StringType::value_type zero_or_one = '?', const typename StringType::value_type any = '.' ); } // namespace text } // namespace claw #include #endif // __CLAW_STRING_ALGORITHM_HPP__ libclaw-1.7.4/claw/system_info.hpp000066400000000000000000000023701216507631600171470ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file system_info.hpp * \brief Include the good interface for system information for your system. * \author Julien Jorge */ #ifndef __CLAW_SYSTEM_INFO_HPP__ #define __CLAW_SYSTEM_INFO_HPP__ #ifdef _WIN32 #include #else #include #endif #endif // __CLAW_SYSTEM_INFO_HPP__ libclaw-1.7.4/claw/system_info_unix.hpp000066400000000000000000000065031216507631600202140ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file system_info_unix.hpp * \brief A class to get some informations about the system in which your * program runs. * \author Julien Jorge */ #ifndef __CLAW_SYSTEM_INFO_UNIX_HPP__ #define __CLAW_SYSTEM_INFO_UNIXHPP__ #include #include namespace claw { /** * \brief A class to get some informations about the system in which your * program runs. * \author Julien Jorge */ class system_info { public: /*------------------------------------------------------------------------*/ /** * \brief Get the name of the user (the name used for the connection). */ static std::string get_user_name() { std::string result( get_environment("USER") ); if ( result.empty() ) result = get_environment("LOGNAME"); return result; } // get_user_name() /*------------------------------------------------------------------------*/ /** * \brief Get the path of the user's personnal directory. */ static std::string get_user_directory() { return get_environment("HOME"); } // get_user_directory() /*------------------------------------------------------------------------*/ /** * \brief Get system's paths. */ template static void get_path( Sequence& path ) { // } // get_path() /*------------------------------------------------------------------------*/ /** * \brief Get the name of out host. */ static std::string get_host_name() { return get_environment("HOSTNAME"); } // get_host_name() /*------------------------------------------------------------------------*/ /** * \brief Get the path of the directory used by the system to save temporary * files. */ static std::string get_temporary_directory() { return get_environment("TMPDIR"); } // get_temporary_directory() /*------------------------------------------------------------------------*/ /** * \brief Get an environment variable. * \param var The name of the variable to get. */ static std::string get_environment( const std::string& var ) { char* value = getenv( var.c_str() ); std::string result; if ( value ) result = value; return result; } // get_environment() }; // class system_info } // namespace claw #endif // __CLAW_SYSTEM_INFO_UNIX_HPP__ libclaw-1.7.4/claw/system_info_win32.hpp000066400000000000000000000063451216507631600201770ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file system_info_win32.hpp * \brief A class to get some informations about the system in which your * program runs. * \author Julien Jorge */ #ifndef __CLAW_SYSTEM_INFO_WIN32_HPP__ #define __CLAW_SYSTEM_INFO_WIN32HPP__ #include #include namespace claw { /** * \brief A class to get some informations about the system in which your * program runs. * \author Julien Jorge */ class system_info { public: /*------------------------------------------------------------------------*/ /** * \brief Get the name of the user (the name used for the connection). */ static std::string get_user_name() { return get_environment("USERNAME"); } // get_user_name() /*------------------------------------------------------------------------*/ /** * \brief Get the path of the user's personnal directory. */ static std::string get_user_directory() { return get_environment("USERPROFILE"); } // get_user_directory() /*------------------------------------------------------------------------*/ /** * \brief Get system's paths. */ template static void get_path( Sequence& path ) { // } // get_path() /*------------------------------------------------------------------------*/ /** * \brief Get the name of our host. */ static std::string get_host_name() { return get_environment("COMPUTERNAME"); } // get_host_name() /*------------------------------------------------------------------------*/ /** * \brief Get the path of the directory used by the system to save temporary * files. */ static std::string get_temporary_directory() { return get_environment("TEMP"); } // get_temporary_directory() /*------------------------------------------------------------------------*/ /** * \brief Get an environment variable. * \param var The name of the variable to get. */ static std::string get_environment( const std::string& var ) { char* value = getenv( var.c_str() ); std::string result; if ( value ) result = value; return result; } // get_environment() }; // class system_info } // namespace claw #endif // __CLAW_SYSTEM_INFO_WIN32_HPP__ libclaw-1.7.4/claw/targa.hpp000066400000000000000000000375771216507631600157270ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file targa.hpp * \brief A class for targa pictures. * \author Julien Jorge */ #ifndef __CLAW_TARGA_HPP__ #define __CLAW_TARGA_HPP__ #include #include #include #include #include #include namespace claw { namespace graphic { /** * \brief A class for targa pictures. * \author Julien Jorge */ class targa : public image { private: /*----------------------------------------------------------------------*/ /** * \brief Tool class used for defining the structures of the datas stored * in a targa file. * \author Julien Jorge */ class file_structure { public: enum image_coding { color_mapped = 1, true_color = 2, black_and_white = 3, rle_color_mapped = 9, rle_true_color = 10, rle_black_and_white = 11 }; // enum image_coding # pragma pack (push,1) /*--------------------------------------------------------------------*/ /** * \brief Header of a targa file. */ class header { public: header(); header( unsigned int w, unsigned int h ); public: /** \brief Image identifier length. */ char id_length; /** \brief 1 if there is a color map, 0 otherwise. */ char color_map; /** \brief Image type. */ char image_type; /** \brief Color map specification. */ struct { /** \brief Index of the first color map entry. */ unsigned short first_entry_index; /** \brief Total number of color map entries included. */ unsigned short length; /** \brief Number of bits per enrty. */ unsigned char entry_size; } color_map_specification; /** \brief Image specification. */ struct specification { /** \brief Lower left corner X-origin. */ unsigned short x_origin; /** \brief Lower left corner Y-origin. */ unsigned short y_origin; /** \brief Image width. */ unsigned short width; /** \brief Image height. */ unsigned short height; /** \brief Bits per pixel. */ unsigned char bpp; /** \brief descriptor. */ unsigned char descriptor; bool up_down_oriented() const ; bool left_right_oriented() const ; unsigned char alpha() const; }; // struct specification /** \brief The specification of the image. */ specification image_specification; }; // struct header /*--------------------------------------------------------------------*/ /** * \brief Item in the developper directory. */ struct developer_item { /** \brief Item identifier. */ unsigned short tag; /** \brief Offset in the file. */ unsigned int offset; /** \brief Fielf size. */ unsigned int size; }; // struct developer_item /*--------------------------------------------------------------------*/ /** * \brief Extension area. * \todo Describe this the day it seems useful. */ struct extension { }; // struct extension /*--------------------------------------------------------------------*/ /** * \brief Footer of a targa file. */ class footer { public: footer(); bool is_valid() const; public: /** \brief Offset of the extension area. */ unsigned int extension_offset; /** \brief Offset of the developer directory. */ unsigned int developer_offset; /** \brief Footer identier. Must be as long as std::string("TRUEVISION-XFILE.") + 1 (for the last '\\0').*/ char signature[18]; private: /** \brief The string content in the signature. */ static const std::string s_signature; }; // struct footer # pragma pack (pop) }; // class file_structure /*----------------------------------------------------------------------*/ /** * \brief A pixel color in 16 bits in targa files. * * \remark We need a type for template specialisation. No content is * needed. */ struct pixel16 { }; // struct pixel16 /*----------------------------------------------------------------------*/ /** * \brief A pixel color in 8 bits in targa files. * * \remark We need a type for template specialisation. No content is * needed. */ struct pixel8 { }; // struct pixel8 /*----------------------------------------------------------------------*/ /** * \brief A color palette of RGBA colors. */ typedef color_palette color_palette32; public: /*----------------------------------------------------------------------*/ /** * \brief This class read data from a targa file and store it in an * image. * \author Julien Jorge */ class reader : private file_structure { private: /*--------------------------------------------------------------------*/ /** * \brief The type of the input buffer associated with the file when * decoding RLE files. * * \b Template \b parameters * - \a Pixel, the type of the pixels in the input buffer. */ template class file_input_buffer : public buffered_istream { private: /** \brief The type of the pixels in the input buffer. */ typedef Pixel pixel_type; public: file_input_buffer( std::istream& f ); rgba_pixel_8 get_pixel(); }; // class file_input_buffer /*--------------------------------------------------------------------*/ /** * \brief The type of the input buffer associated with the file when * decoding RLE files using a color palette. * * \b Template \b parameters * - \a Pixel, the type of the pixels in the input buffer. */ template class mapped_file_input_buffer: public buffered_istream { private: /** \brief The type of the pixels in the input buffer. */ typedef Pixel pixel_type; public: mapped_file_input_buffer( std::istream& f, const color_palette32& p ); rgba_pixel_8 get_pixel(); private: /** \brief The color map of the image. */ const color_palette32& m_palette; }; // class mapped_file_input_buffer /*--------------------------------------------------------------------*/ /** * \brief The output buffer for the RLE decoder. * * \b Template \b parameters * - \a InputBuffer, the type of the input buffer. * * \author Julien Jorge */ template< typename InputBuffer > class rle_targa_output_buffer { private: /** \brief The type of he pixels in the input buffer. */ typedef rgba_pixel_8 pixel_type; /** \brief The type of the input buffer. */ typedef InputBuffer input_buffer_type; public: rle_targa_output_buffer( image& img, bool up_down, bool left_right ); void fill( unsigned int n, rgba_pixel_8 pattern ); void copy( unsigned int n, input_buffer_type& buffer ); bool completed() const; private: void adjust_position(int x); private: /** \brief The targa image to fill. */ image& m_image; /** \brief Current column index in the image. */ unsigned int m_x; /** \brief Current row index in the image. */ unsigned int m_y; /** \brief Horizontal increment. */ const int m_x_inc; /** \brief Vertical increment. */ const int m_y_inc; }; // class rle_targa_output_buffer /*--------------------------------------------------------------------*/ /** * \brief RLE decoder for targa RLE format * * \b Template \b parameters : * - \a Pixel, the type of the pixels in the file. * - \a OutputBuffer, the type of the output buffer. * * The \a OutputBuffer type must match the type requirements of the * template parameter OutputBuffer of the rle_decoder class. * * \author Julien Jorge */ template< typename InputBuffer, typename OutputBuffer = rle_targa_output_buffer > class rle_targa_decoder : public rle_decoder< rgba_pixel_8, InputBuffer, OutputBuffer > { public: /** \brief Type of the input buffer. */ typedef InputBuffer input_buffer_type; /** \brief Type of the output buffer. */ typedef OutputBuffer output_buffer_type; private: virtual void read_mode( input_buffer_type& input, output_buffer_type& output ); }; // class rle_targa_decoder /*--------------------------------------------------------------------*/ /** \brief RLE decoder for 32 bpp targa images. */ typedef rle_targa_decoder< file_input_buffer > rle32_decoder; /*--------------------------------------------------------------------*/ /** \brief RLE decoder for 24 bpp targa images. */ typedef rle_targa_decoder< file_input_buffer > rle24_decoder; /*--------------------------------------------------------------------*/ /** \brief RLE decoder for 16 bpp targa images. */ typedef rle_targa_decoder< file_input_buffer > rle16_decoder; /*--------------------------------------------------------------------*/ /** \brief RLE decoder for color mapped 8 bpp targa images. */ typedef rle_targa_decoder< mapped_file_input_buffer > rle8_decoder; public: reader( image& img ); reader( image& img, std::istream& f ); void load( std::istream& f ); private: void check_if_targa( std::istream& f ) const; void load_palette ( const header& h, std::istream& f, color_palette32& palette ) const; void load_color_mapped( const header& h, std::istream& f ); void load_rle_color_mapped( const header& h, std::istream& f ); void load_true_color( const header& h, std::istream& f ); void load_rle_true_color( const header& h, std::istream& f ); template void load_color_mapped_raw ( const header& h, std::istream& f, const color_palette32& palette ); template void decompress_rle_color_mapped ( const header& h, std::istream& f, const color_palette32& palette ); template void load_true_color_raw( const header& h, std::istream& f ); template void decompress_rle_true_color( const header& h, std::istream& f ); template void load_palette_content( std::istream& f, color_palette32& palette ) const; private: /** \brief The image in which we store the data we read. */ image& m_image; }; // class reader /*----------------------------------------------------------------------*/ /** * \brief This class write an image in a targa file. * \author Julien Jorge */ class writer : private file_structure { public: /*--------------------------------------------------------------------*/ /** * \brief The type of the output buffer associated with the file when * encoding RLE data. * * \b Template \b parameters * - \a Pixel, the type of the pixels in the output buffer. */ template class file_output_buffer { public: /** \brief The type of the pixels in the input buffer. */ typedef Pixel pixel_type; /** \brief The type of the patterns to encode. */ typedef pixel_type pattern_type; public: file_output_buffer( std::ostream& os ); void encode( unsigned int n, pattern_type pattern ); template void raw( Iterator first, Iterator last ); unsigned int min_interesting() const; unsigned int max_encodable() const; /** * \brief Write a pixel in the stream and set its value in the good * order. * \param p The pixel to write. */ void order_pixel_bytes( const pixel_type& p ); private: /** \brief The stream in which we write. */ std::ostream& m_stream; }; // class file_output_buffer /*--------------------------------------------------------------------*/ /** * \brief RLE encoder for targa format * * \b Template \b parameters : * - \a Pixel, the type of the pixels in the file. * * \author Julien Jorge */ template class rle_targa_encoder : public rle_encoder< file_output_buffer > { public: /** \brief Type of the output buffer. */ typedef file_output_buffer output_buffer_type; }; // class rle_targa_encoder /*--------------------------------------------------------------------*/ /** \brief RLE encoder for 32 bpp targa images. */ typedef rle_targa_encoder rle32_encoder; public: writer( const image& img ); writer( const image& img, std::ostream& f, bool rle ); void save( std::ostream& f, bool rle ) const; private: void save_true_color( std::ostream& os ) const; void save_rle_true_color( std::ostream& os ) const; private: /** \brief The image from which we read the data. */ const image& m_image; }; // class writer public: targa( unsigned int w, unsigned int h ); targa( const image& that ); targa( std::istream& f ); void save( std::ostream& os, bool rle ) const; }; // class targa } // namespace graphic } // namespace claw #include #include #endif // __CLAW_TARGA_HPP__ libclaw-1.7.4/claw/tree.hpp000066400000000000000000000044711216507631600155530ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file tree.hpp * \brief A tree structure with any number of children. * \author Julien Jorge */ #ifndef __CLAW_TREE_HPP__ #define __CLAW_TREE_HPP__ #include namespace claw { /** * \brief A tree structure with any number of children. * \author Julien Jorge */ template class tree { public: /** \brief The type of the value stored in the nodes. */ typedef T value_type; /** \brief The type of the current class. */ typedef tree self_type; private: /** \brief The type of the list in which are stored the children. */ typedef std::list< tree > child_list; public: typedef typename child_list::iterator iterator; typedef typename child_list::const_iterator const_iterator; public: tree(); explicit tree( const T& that ); bool operator==( const self_type& that ) const; bool is_leaf() const; self_type& add_child( const T& v ); self_type& add_child( const self_type& v ); iterator find( const T& v ); const_iterator find( const T& v ) const; iterator begin(); iterator end(); const_iterator begin() const; const_iterator end() const; public: /** \brief The value in this node. */ T value; private: /** \brief The children of this node. */ child_list m_child; }; // class tree } // namespace claw #include #endif // __CLAW_TREE_HPP__ libclaw-1.7.4/claw/trie.hpp000066400000000000000000000067561216507631600155670ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file trie.hpp * \brief A trie structure. * \author Julien Jorge */ #ifndef __CLAW_TRIE_HPP__ #define __CLAW_TRIE_HPP__ #include #include #include namespace claw { /** * \brief This class is a trie tree. * * Trie trees are used for storage and count of linear datas with similar * prefixes, typically words. * For example, if you insert words * - ant * - antagonize * - antagonism * - ant * It will use as much memory space as * - antagonize * - antagonism * Nodes for "ant" are shared between words, likewise for "antagoni" for the * two last word, and a counter is set for each word. So "ant" will have a * count of 2. * \remark Type requirements : * - T is EquallyComparable ; * - Comp is a binary predicate such that Comp(T a,T b) == true if a == b. * \invariant empty <=> (size()==0) * \author Julien Jorge */ template > class trie { private: //************************ trie::trie_node ******************************** /** * \brief Node of our trie. * Left subtree will be other suggestions for the current position, * right subtree will be following items for the word seen from the root * to here. */ struct trie_node : public binary_node< trie_node > { /** \brief Value of the node */ T value; /** * \brief Times we found the word from the root to this node. * Zero if never seen */ unsigned int count; trie_node( const T& val, unsigned int c = 0 ); trie_node( const trie_node& that ); }; // trie_node; public: //****************************** trie ************************************* typedef const T value_type; typedef Comp value_equal_to; private: typedef trie_node* trie_node_ptr; public: trie(); trie( const trie& that ); ~trie(); unsigned int size() const; bool empty() const; void clear(); template void insert(InputIterator first, InputIterator last); template unsigned int count(InputIterator first, InputIterator last); private: /** \brief Function object use to check if nodes have the same value. */ static value_equal_to s_value_equal_to; /** \brief Main structure*/ trie_node_ptr m_tree; /** \brief Words count */ unsigned int m_size; }; // class trie } // namespace claw #include #endif // __CLAW_TRIE_HPP__ libclaw-1.7.4/claw/tween/000077500000000000000000000000001216507631600152175ustar00rootroot00000000000000libclaw-1.7.4/claw/tween/base_tweener.hpp000066400000000000000000000047621216507631600204040ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/base_tweener.hpp * \brief Common interface for all tweeners. * \author Julien Jorge */ #ifndef __CLAW_TWEEN_BASE_TWEENER_HPP__ #define __CLAW_TWEEN_BASE_TWEENER_HPP__ #include #include namespace claw { namespace tween { /** * \brief Common interface for all tweeners. * \author Julien Jorge * \sa \ref tweeners */ class base_tweener { public: /** * \brief The type of the function called to notify the end of the * tweener. */ typedef boost::function finish_callback; public: virtual ~base_tweener(); base_tweener* clone() const; bool is_finished() const; double update( double dt ); void on_finished( finish_callback f ); private: void notify_finished() const; /** * \brief Create a copy of this allocated with new. */ virtual base_tweener* do_clone() const = 0; /** * \brief Tell if this tweener is over. */ virtual bool do_is_finished() const = 0; /** * \brief Update the tweener for a given amount of time. * \param dt The duration of the update. * \return The amount of extra time in dt after the end of the update. */ virtual double do_update( double dt ) = 0; private: /** \brief The callback executed when the tweener is finished. */ std::list m_on_finished; }; // class base_tweener } // namespace tween } // namespace claw #endif // __CLAW_TWEEN_BASE_TWEENER_HPP__ libclaw-1.7.4/claw/tween/easing/000077500000000000000000000000001216507631600164655ustar00rootroot00000000000000libclaw-1.7.4/claw/tween/easing/easing_back.hpp000066400000000000000000000027341216507631600214320ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/easing/easing_back.hpp * \brief Easing functions for the tweener. * \author Julien Jorge */ #ifndef __CLAW_TWEEN_EASING_BACK_HPP__ #define __CLAW_TWEEN_EASING_BACK_HPP__ #include "claw/tween/easing/symmetric_easing.hpp" namespace claw { namespace tween { double easing_back_func( double t ); /** * \brief Easing functions for the tweener. * \author Julien Jorge */ typedef symmetric_easing easing_back; } // namespace tween } // namespace claw #endif // __CLAW_TWEEN_EASING_BACK_HPP__ libclaw-1.7.4/claw/tween/easing/easing_bounce.hpp000066400000000000000000000027521216507631600220050ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/easing/easing_bounce.hpp * \brief Easing functions for the tweener. * \author Julien Jorge */ #ifndef __CLAW_TWEEN_EASING_BOUNCE_HPP__ #define __CLAW_TWEEN_EASING_BOUNCE_HPP__ #include "claw/tween/easing/symmetric_easing.hpp" namespace claw { namespace tween { double easing_bounce_func( double t ); /** * \brief Easing functions for the tweener. * \author Julien Jorge */ typedef symmetric_easing easing_bounce; } // namespace tween } // namespace claw #endif // __CLAW_TWEEN_EASING_BOUNCE_HPP__ libclaw-1.7.4/claw/tween/easing/easing_circ.hpp000066400000000000000000000027551216507631600214550ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/easing/easing_circ.hpp * \brief Easing functions for the tweener. * \author Julien Jorge */ #ifndef __CLAW_TWEEN_EASING_CIRC_HPP__ #define __CLAW_TWEEN_EASING_CIRC_HPP__ #include "claw/tween/easing/symmetric_easing.hpp" #include namespace claw { namespace tween { double easing_circ_func( double t ); /** * \brief Easing functions for the tweener. * \author Julien Jorge */ typedef symmetric_easing easing_circ; } // namespace tween } // namespace claw #endif // __CLAW_TWEEN_EASING_CIRC_HPP__ libclaw-1.7.4/claw/tween/easing/easing_cubic.hpp000066400000000000000000000027431216507631600216170ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/easing/easing_cubic.hpp * \brief Easing functions for the tweener. * \author Julien Jorge */ #ifndef __CLAW_TWEEN_EASING_CUBIC_HPP__ #define __CLAW_TWEEN_EASING_CUBIC_HPP__ #include "claw/tween/easing/symmetric_easing.hpp" namespace claw { namespace tween { double easing_cubic_func( double t ); /** * \brief Easing functions for the tweener. * \author Julien Jorge */ typedef symmetric_easing easing_cubic; } // namespace tween } // namespace claw #endif // __CLAW_TWEEN_EASING_CUBIC_HPP__ libclaw-1.7.4/claw/tween/easing/easing_elastic.hpp000066400000000000000000000027611216507631600221560ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/easing/easing_elastic.hpp * \brief Easing functions for the tweener. * \author Julien Jorge */ #ifndef __CLAW_TWEEN_EASING_ELASTIC_HPP__ #define __CLAW_TWEEN_EASING_ELASTIC_HPP__ #include "claw/tween/easing/symmetric_easing.hpp" namespace claw { namespace tween { double easing_elastic_func( double t ); /** * \brief Easing functions for the tweener. * \author Julien Jorge */ typedef symmetric_easing easing_elastic; } // namespace tween } // namespace claw #endif // __CLAW_TWEEN_EASING_ELASTIC_HPP__ libclaw-1.7.4/claw/tween/easing/easing_expo.hpp000066400000000000000000000027341216507631600215050ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/easing/easing_expo.hpp * \brief Easing functions for the tweener. * \author Julien Jorge */ #ifndef __CLAW_TWEEN_EASING_EXPO_HPP__ #define __CLAW_TWEEN_EASING_EXPO_HPP__ #include "claw/tween/easing/symmetric_easing.hpp" namespace claw { namespace tween { double easing_expo_func( double t ); /** * \brief Easing functions for the tweener. * \author Julien Jorge */ typedef symmetric_easing easing_expo; } // namespace tween } // namespace claw #endif // __CLAW_TWEEN_EASING_EXPO_HPP__ libclaw-1.7.4/claw/tween/easing/easing_linear.hpp000066400000000000000000000027521216507631600220040ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/easing/easing_linear.hpp * \brief Easing functions for the tweener. * \author Julien Jorge */ #ifndef __CLAW_TWEEN_EASING_LINEAR_HPP__ #define __CLAW_TWEEN_EASING_LINEAR_HPP__ #include "claw/tween/easing/symmetric_easing.hpp" namespace claw { namespace tween { double easing_linear_func( double t ); /** * \brief Easing functions for the tweener. * \author Julien Jorge */ typedef symmetric_easing easing_linear; } // namespace tween } // namespace claw #endif // __CLAW_TWEEN_EASING_LINEAR_HPP__ libclaw-1.7.4/claw/tween/easing/easing_none.hpp000066400000000000000000000031001216507631600214550ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/easing/easing_none.hpp * \brief Easing functions for the tweener. Those functions do nothing. * \author Julien Jorge */ #ifndef __CLAW_TWEEN_EASING_NONE_HPP__ #define __CLAW_TWEEN_EASING_NONE_HPP__ namespace claw { namespace tween { /** * \brief Easing functions for the tweener. Those functions do nothing. * \author Julien Jorge */ class easing_none { public: static double ease_in( double t ); static double ease_out( double t ); static double ease_in_out( double t ); }; // class easing_none } // namespace tween } // namespace claw #endif // __CLAW_TWEEN_EASING_NONE_HPP__ libclaw-1.7.4/claw/tween/easing/easing_quad.hpp000066400000000000000000000027341216507631600214640ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/easing/easing_quad.hpp * \brief Easing functions for the tweener. * \author Julien Jorge */ #ifndef __CLAW_TWEEN_EASING_QUAD_HPP__ #define __CLAW_TWEEN_EASING_QUAD_HPP__ #include "claw/tween/easing/symmetric_easing.hpp" namespace claw { namespace tween { double easing_quad_func( double t ); /** * \brief Easing functions for the tweener. * \author Julien Jorge */ typedef symmetric_easing easing_quad; } // namespace tween } // namespace claw #endif // __CLAW_TWEEN_EASING_QUAD_HPP__ libclaw-1.7.4/claw/tween/easing/easing_quart.hpp000066400000000000000000000027431216507631600216660ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/easing/easing_quart.hpp * \brief Easing functions for the tweener. * \author Julien Jorge */ #ifndef __CLAW_TWEEN_EASING_QUART_HPP__ #define __CLAW_TWEEN_EASING_QUART_HPP__ #include "claw/tween/easing/symmetric_easing.hpp" namespace claw { namespace tween { double easing_quart_func( double t ); /** * \brief Easing functions for the tweener. * \author Julien Jorge */ typedef symmetric_easing easing_quart; } // namespace tween } // namespace claw #endif // __CLAW_TWEEN_EASING_QUART_HPP__ libclaw-1.7.4/claw/tween/easing/easing_quint.hpp000066400000000000000000000027431216507631600216720ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/easing/easing_quint.hpp * \brief Easing functions for the tweener. * \author Julien Jorge */ #ifndef __CLAW_TWEEN_EASING_QUINT_HPP__ #define __CLAW_TWEEN_EASING_QUINT_HPP__ #include "claw/tween/easing/symmetric_easing.hpp" namespace claw { namespace tween { double easing_quint_func( double t ); /** * \brief Easing functions for the tweener. * \author Julien Jorge */ typedef symmetric_easing easing_quint; } // namespace tween } // namespace claw #endif // __CLAW_TWEEN_EASING_QUINT_HPP__ libclaw-1.7.4/claw/tween/easing/easing_sine.hpp000066400000000000000000000027341216507631600214700ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/easing/easing_sine.hpp * \brief Easing functions for the tweener. * \author Julien Jorge */ #ifndef __CLAW_TWEEN_EASING_SINE_HPP__ #define __CLAW_TWEEN_EASING_SINE_HPP__ #include "claw/tween/easing/symmetric_easing.hpp" namespace claw { namespace tween { double easing_sine_func( double t ); /** * \brief Easing functions for the tweener. * \author Julien Jorge */ typedef symmetric_easing easing_sine; } // namespace tween } // namespace claw #endif // __CLAW_TWEEN_EASING_SINE_HPP__ libclaw-1.7.4/claw/tween/easing/impl/000077500000000000000000000000001216507631600174265ustar00rootroot00000000000000libclaw-1.7.4/claw/tween/easing/impl/symmetric_easing.tpp000066400000000000000000000046171216507631600235250ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/easing/impl/symmetric_easing.tpp * \brief Implementation of the claw::tween::symmetric_easing class. * \author Julien Jorge */ /*----------------------------------------------------------------------------*/ /** * \brief Apply the easing at the beginning of the tweener. * \param t The ratio of the date, in (0, 1), representing the total progression * of the tweener. */ template double claw::tween::symmetric_easing::ease_in( double t ) { return Function(t); } // symmetric_easing::ease_in() /*----------------------------------------------------------------------------*/ /** * \brief Apply the easing at the end of the tweener. * \param t The ratio of the date, in (0, 1), representing the total progression * of the tweener. */ template double claw::tween::symmetric_easing::ease_out( double t ) { return 1 - ease_in( 1 - t ); } // symmetric_easing::ease_out() /*----------------------------------------------------------------------------*/ /** * \brief Apply the easing at the beginning and the end of the tweener. * \param t The ratio of the date, in (0, 1), representing the total progression * of the tweener. */ template double claw::tween::symmetric_easing::ease_in_out( double t ) { if ( t < 0.5 ) return ease_in( 2 * t ) / 2; else return 0.5 + ease_out( 2 * t - 1 ) / 2; } // symmetric_easing::ease_in_out() libclaw-1.7.4/claw/tween/easing/symmetric_easing.hpp000066400000000000000000000032071216507631600225420ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/easing/symmetric_easing.hpp * \brief Easing functions for the tweener. * \author Julien Jorge */ #ifndef __CLAW_TWEEN_SYMMETRIC_EASING_HPP__ #define __CLAW_TWEEN_SYMMETRIC_EASING_HPP__ namespace claw { namespace tween { /** * \brief Easing functions for the tweener. * \author Julien Jorge */ template class symmetric_easing { public: static double ease_in( double t ); static double ease_out( double t ); static double ease_in_out( double t ); }; // class symmetric_easing } // namespace tween } // namespace claw #include "claw/tween/easing/impl/symmetric_easing.tpp" #endif // __CLAW_TWEEN_SYMMETRIC_EASING_HPP__ libclaw-1.7.4/claw/tween/single_tweener.hpp000066400000000000000000000064141216507631600207470ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/single_tweener.hpp * \brief A single_tweener makes a value to evolve through time from a initial * value to an end value according to a given function. * \author Julien Jorge */ #ifndef __CLAW_TWEEN_SINGLE_TWEENER_HPP__ #define __CLAW_TWEEN_SINGLE_TWEENER_HPP__ #include #include #include namespace claw { namespace tween { /** * \brief A single_tweener makes a value to evolve through time from a * initial value to an end value according to a given function. * \author Julien Jorge * \sa \ref tweeners */ class single_tweener: public base_tweener { public: /** \brief The type of the function called when the single_tweener is updated. */ typedef boost::function update_function; /** \brief The type of the function used to compute the new value. */ typedef boost::function easing_function; public: single_tweener(); single_tweener ( double init, double end, double duration, update_function callback, easing_function e ); single_tweener ( double& val, double end, double duration, easing_function e ); double get_init() const; void set_init( double v ); double get_end() const; void set_end( double v ); double get_duration() const; void set_duration( double v ); void set_callback( update_function f ); void set_easing( easing_function f ); double get_value() const; private: single_tweener* do_clone() const; bool do_is_finished() const; double do_update( double dt ); private: /** \brief The initial value. */ double m_init; /** \brief The final value. */ double m_end; /** \brief The current date in the timeline of the single_tweener. */ double m_date; /** \brief The total duration of the single_tweener. */ double m_duration; /** \brief The function called when the single_tweener is updated. */ update_function m_callback; /** \brief The function used to compute the new value. */ easing_function m_easing; }; // class single_tweener } // namespace tween } // namespace claw #endif // __CLAW_TWEEN_SINGLE_TWEENER_HPP__ libclaw-1.7.4/claw/tween/tweener.hpp000066400000000000000000000045461216507631600174120ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/tweener.hpp * \brief A tweener makes a value to evolve through time from a initial value to * an end value according to a given function. * \author Julien Jorge */ #ifndef __CLAW_TWEEN_TWEENER_HPP__ #define __CLAW_TWEEN_TWEENER_HPP__ #include #include namespace claw { namespace tween { class base_tweener; /** * \brief A tweener makes a value to evolve through time from a initial * value to an end value according to a given function. * \author Julien Jorge * \sa \ref tweeners */ class tweener { public: /** * \brief The type of the function called to notify the end of the * tweener. */ typedef boost::function finish_callback; public: tweener(); tweener( const tweener& that ); tweener( const base_tweener& that ); ~tweener(); tweener& operator=( const tweener& that ); void swap( tweener& that ) throw(); bool is_finished() const; double update( double dt ); void on_finished( finish_callback f ); private: /** \brief The implementation of this tweener. */ base_tweener* m_impl; }; // class tweener } // namespace tween } // namespace claw namespace std { template<> void swap( claw::tween::tweener& a, claw::tween::tweener& b ); } // namespace std #endif // __CLAW_TWEEN_TWEENER_HPP__ libclaw-1.7.4/claw/tween/tweener_group.hpp000066400000000000000000000036741216507631600206270ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/tweener_group.hpp * \brief The tweener group manages several tweeners and remove them when they * are over. * \author Julien Jorge */ #ifndef __CLAW_TWEEN_TWEENER_GROUP_HPP__ #define __CLAW_TWEEN_TWEENER_GROUP_HPP__ #include #include #include namespace claw { namespace tween { /** * \brief The tweener group manages several tweeners and remove them when * they are over. * \author Julien Jorge * \sa \ref tweeners */ class tweener_group: public base_tweener { public: void insert( const tweener& t ); void clear(); bool empty() const; private: tweener_group* do_clone() const; bool do_is_finished() const; double do_update( double dt ); private: /** \brief The tweeners. */ std::list m_tweeners; }; // class tweener_group } // namespace tween } // namespace claw #endif // __CLAW_TWEEN_TWEENER_GROUP_HPP__ libclaw-1.7.4/claw/tween/tweener_sequence.hpp000066400000000000000000000040731216507631600212750ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file claw/tween/tweener_sequence.hpp * \brief The tweener sequence manages several tweeners in a common timeline. * \author Julien Jorge */ #ifndef __CLAW_TWEEN_TWEENER_SEQUENCE_HPP__ #define __CLAW_TWEEN_TWEENER_SEQUENCE_HPP__ #include #include #include namespace claw { namespace tween { /** * \brief The tweener sequence manages several tweeners in a common * timeline. * * A tweener in a tweener sequence will start only when all the previous * tweeners in the same sequence are over. * * \author Julien Jorge * \sa \ref tweeners */ class tweener_sequence: public base_tweener { public: void insert( const tweener& t ); void clear(); bool empty() const; private: tweener_sequence* do_clone() const; bool do_is_finished() const; double do_update( double dt ); private: /** \brief The tweeners. */ std::list m_tweeners; }; // class tweener_sequence } // namespace tween } // namespace claw #endif // __CLAW_TWEEN_TWEENER_SEQUENCE_HPP__ libclaw-1.7.4/claw/types.hpp000066400000000000000000000110641216507631600157540ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file types.hpp * \brief Some classes for the raw manipulation of the base types. * \author Julien Jorge */ #include #include #ifndef __CLAW_TYPES_HPP__ #define __CLAW_TYPES_HPP__ namespace claw { #ifdef CLAW_HAS_LONG_LONG typedef meta::type_list non_standard_signed_types; typedef meta::type_list non_standard_unsigned_types; #else // !def CLAW_HAS_LONG_LONG typedef meta::no_type non_standard_signed_types; typedef meta::no_type non_standard_unsigned_types; #endif // CLAW_HAS_LONG_LONG /** \brief This is the list of c++ signed integer types. */ typedef meta::type_list < signed char, meta::type_list < signed short, meta::type_list > > signed_integers; /** \brief This is the list of c++ unsigned integer types. */ typedef meta::type_list < unsigned char, meta::type_list < unsigned short, meta::type_list > > unsigned_integers; /** * \brief This meta class finds, in a list of types, the first type stored * exactly with a given number of bits. * * \b Template \b parameters * - \a Size The number of bits in the type to find, * - \a TypeList A list of types (see meta::type_list). */ template struct find_type_by_size { private: typedef typename TypeList::head_type head_type; typedef typename TypeList::queue_type queue_type; public: /** \brief If the size of head_type matches the desired one, then the result is head_type, otherwise we search the type in the remaining ones . */ typedef typename meta::if_then_else < sizeof(head_type) * 8 == Size, head_type, typename find_type_by_size::type >::result type; }; // find_type_by_size /** \brief End of the recursion of the find_type_by_size class. */ template struct find_type_by_size { /** \brief This is an incomplete type that should make the compiler failing. */ struct type; }; // find_type_by_size /** * \brief Define the type of a signed integer stored with a given number of * bits. * \b Template \b parameters * - \a Size The number of bytes in the types. */ template struct integer_of_size { /** \brief The integer type that matches the given size. */ typedef typename find_type_by_size::type type; }; // struct integer_of_size /** * \brief Define the type of an unsigned integer stored with a given number of * bits. * \b Template \b parameters * - \a Size The number of bytes in the types. */ template struct unsigned_integer_of_size { /** \brief The integer type that matches the given size. */ typedef typename find_type_by_size::type type; }; // struct unsigned_integer_of_size /** \brief An unsigned integer on 8 bits. */ typedef unsigned_integer_of_size<8>::type u_int_8; /** \brief An unsigned integer on 16 bits. */ typedef unsigned_integer_of_size<16>::type u_int_16; /** \brief An unsigned integer on 32 bits. */ typedef unsigned_integer_of_size<32>::type u_int_32; /** \brief An integer on 8 bits. */ typedef integer_of_size<8>::type int_8; /** \brief An integer on 16 bits. */ typedef integer_of_size<16>::type int_16; /** \brief An integer on 32 bits. */ typedef integer_of_size<32>::type int_32; } // namespace claw #endif // __CLAW_TYPES_HPP__ libclaw-1.7.4/claw/vector_2d.hpp000066400000000000000000000042711216507631600165010ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file vector_2d.hpp * \brief Two dimensional vector. * \author Julien Jorge */ #ifndef __CLAW_VECTOR_2D_HPP__ #define __CLAW_VECTOR_2D_HPP__ #include namespace claw { namespace math { /** * \brief Two dimensional vector. * \author Julien Jorge */ template class vector_2d : public coordinate_2d { public: /** \brief The type of the values we store. */ typedef T value_type; /** \brief The type of the current class. */ typedef vector_2d self_type; /** \brief The type of the parent class. */ typedef coordinate_2d super; public: vector_2d(); template vector_2d( const coordinate_2d& that ); template vector_2d ( const coordinate_2d& p1, const coordinate_2d& p2 ); vector_2d(const value_type& _x, const value_type& _y); value_type length() const; void normalize(); self_type get_orthonormal_clockwise() const; self_type get_orthonormal_anticlockwise() const; value_type dot_product(const self_type& vect) const; }; // class vector_2d } // namespace math } // namespace claw #include #endif // __CLAW_VECTOR_2D_HPP__ libclaw-1.7.4/claw/version.hpp.in000066400000000000000000000024431216507631600167030ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2010 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien_jorge@yahoo.fr */ /** * \file version.hpp * \brief The version of the library. * \author Julien Jorge */ #ifndef __CLAW_VERSION_HPP__ #define __CLAW_VERSION_HPP__ #define CLAW_MAJOR_VERSION ${CLAW_VERSION_MAJOR} #define CLAW_MINOR_VERSION ${CLAW_VERSION_MINOR} #define CLAW_RELEASE_NUMBER ${CLAW_RELEASE_NUMBER} #define CLAW_REVISION_NUMBER ${CLAW_REVISION_NUMBER} #endif // __CLAW_VERSION_HPP__ libclaw-1.7.4/claw/xbm.hpp000066400000000000000000000104421216507631600153750ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file xbm.hpp * \brief A class for xbm pictures. * \author Julien Jorge */ #ifndef __CLAW_XBM_HPP__ #define __CLAW_XBM_HPP__ #include #include #include namespace claw { namespace graphic { /** * \brief A class for xbm pictures. * \author Julien Jorge */ class xbm : public image { public: /*----------------------------------------------------------------------*/ /** * \brief This class read data from a xbm file and store it in an image. * \author Julien Jorge */ class reader { public: reader( image& img ); reader( image& img, std::istream& f ); reader( xbm& img, std::istream& f ); ~reader(); void load( std::istream& f ); private: void read_from_file( std::istream& f ); void read_size( std::istream& f ); unsigned int read_dim( const std::string& line ) const; unsigned int read_bits_per_entry( std::istream& f ) const; void read_name( std::istream& f ); void read_pixels( std::istream& f, unsigned int bpe ) const; void read_line ( std::istream& f, std::string& line, char endchar ) const; void remove_comments ( std::istream& f, std::string& line, char endchar ) const; private: /** \brief The image in which we store the data we read. */ image& m_image; /** \brief The name of the xbm image. */ std::string m_name; /** \brief The position of the hot spot in the image. */ claw::math::coordinate_2d* m_hot; }; // class reader /*----------------------------------------------------------------------*/ /** * \brief This class write an image in a xbm file. * \author Julien Jorge */ class writer { public: /** * \brief Parameters of the writing algorithm. */ struct options { public: options(); options( const std::string& n, const claw::math::coordinate_2d* h ); public: /** \brief The name of the image structure in the file. */ std::string name; /** \brief The position of the hot spot in the image. */ const claw::math::coordinate_2d* hot; }; // options public: writer( const image& img ); writer( const image& img, std::ostream& f, const options& opt = options() ); void save( std::ostream& f, const options& opt = options() ) const; private: void save_bits( std::ostream& f ) const; private: /** \brief The image from which we take the data to save. */ const image& m_image; }; // class writer public: xbm( unsigned int w, unsigned int h ); xbm( const image& that ); xbm( std::istream& f ); ~xbm(); void save( std::ostream& os ) const; void set_name( const std::string& name ); void set_hot( const claw::math::coordinate_2d& hot ); private: /** \brief The name of the image structure in the file. */ std::string m_name; /** \brief The position of the hot spot in the image. */ claw::math::coordinate_2d* m_hot; }; // class xbm } // namespace graphic } // namespace claw #endif // __CLAW_XBM_HPP__ libclaw-1.7.4/cmake-module/000077500000000000000000000000001216507631600155125ustar00rootroot00000000000000libclaw-1.7.4/cmake-module/CMakeLists.txt000066400000000000000000000016221216507631600202530ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw:cmake-modules) if( NOT CLAW_CMAKE_MODULES_INSTALL_PATH ) set( CLAW_CMAKE_MODULES_INSTALL_PATH "share/cmake/libclaw" ) endif( NOT CLAW_CMAKE_MODULES_INSTALL_PATH ) set( CLAW_CMAKE_MODULES libclaw-config.cmake ) #------------------------------------------------------------------------------- # installation install( FILES ${CLAW_CMAKE_MODULES} DESTINATION "${CLAW_CMAKE_MODULES_INSTALL_PATH}" ) #------------------------------------------------------------------------------- # version file set( CLAW_VERSION_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/libclaw-config-version.cmake" ) include(CMakePackageConfigHelpers) write_basic_package_version_file( "${CLAW_VERSION_FILE_NAME}" VERSION "${CLAW_VERSION}" COMPATIBILITY SameMajorVersion ) install( FILES "${CLAW_VERSION_FILE_NAME}" DESTINATION "${CLAW_CMAKE_MODULES_INSTALL_PATH}" ) libclaw-1.7.4/cmake-module/libclaw-config.cmake000066400000000000000000000250271216507631600214020ustar00rootroot00000000000000## ## This module finds if the CLAW (C++ Library Absolutely Wonderful) is ## installed and determines where the include files and libraries ## are. It also determines what the name of the library is. This code ## sets the following variables: ## ## ------------------------------------------------------------------ ## ## CLAW_FOUND = System has the claw library. ## ## CLAW_DEFINITIONS = Compiler definitions (-D). ## ## CLAW_INCLUDE_DIRECTORY = Where to find headers "claw/claw.hpp". ## ## CLAW_LINK_DIRECTORY = Link directory. ## ## CLAW_LIBRARIES = Claw libraries to link to. ## ## CLAW_MAJOR_VERSION = The major version number of the library. ## ## CLAW_MINOR_VERSION = The minor version number of the library. ## ## CLAW_RELEASE_NUMBER = The release number of this version of the library. ## ## CLAW_REVISION_NUMBER = The SVN revision number of the library. To be used ## only when developping with a not yet released ## version of the library. ## ## CLAW_VERSION = The full version of the library, as ## Major.Minor.Release. ## ## ------------------------------------------------------------------ ## ## Author Julien Jorge (10/2010) ## ## ------------------------------------------------------------------ ## IF( CLAW_FOUND ) SET(CLAW_FIND_QUIETLY TRUE) ENDIF( CLAW_FOUND ) IF (UNIX) ## ###################################################################### ## ## UNIX/Linux specific: ## ## use backquoted claw-config to query and set flags and libs ## STRING(REPLACE : " " SEARCH_PATH $ENV{PATH}) # claw-config should be in your path anyhow FIND_PROGRAM(CMAKE_CLAW_CLAWCONFIG_EXECUTABLE claw-config ${SEARCH_PATH}) # check wether claw-config was found: IF(CMAKE_CLAW_CLAWCONFIG_EXECUTABLE) # set CXXFLAGS to be fed into CMAKE_DEFINITIONS by the user: EXEC_PROGRAM( ${CMAKE_CLAW_CLAWCONFIG_EXECUTABLE} ARGS "--cxxflags" OUTPUT_VARIABLE CLAW_DEFINITIONS ) # evaluate claw-config output to separate linker flags and linkdirs for # rpath: EXEC_PROGRAM(${CMAKE_CLAW_CLAWCONFIG_EXECUTABLE} ARGS "--libs" OUTPUT_VARIABLE CLAW_CONFIG_LINK_DIRECTORY_WITH_PREFIX ) ## extract linkdirs (-L) ## use regular expression to match wildcard equivalent "-L*" ## with is a space or a semicolon STRING( REGEX REPLACE "[-][L](.+)$" "\\1" CLAW_LINK_DIRECTORY "${CLAW_CONFIG_LINK_DIRECTORY_WITH_PREFIX}" ) # set CXXFLAGS to be fed into CMAKE_DEFINITIONS by the user: EXEC_PROGRAM( ${CMAKE_CLAW_CLAWCONFIG_EXECUTABLE} ARGS "--include" OUTPUT_VARIABLE CLAW_CONFIG_INCLUDE_DIRECTORIES_WITH_PREFIX ) ## extract include dirs (-I) for rpath ## use regular expression to match wildcard equivalent "-I*" ## with is a space or a semicolon STRING( REGEX REPLACE "[-][I](.+)$" "\\1" CLAW_INCLUDE_DIRECTORY "${CLAW_CONFIG_INCLUDE_DIRECTORIES_WITH_PREFIX}" ) # we really need claw-config... ELSE(CMAKE_CLAW_CLAWCONFIG_EXECUTABLE) MESSAGE(SEND_ERROR "Cannot find claw-config anywhere on the system. Please put the file into your path or specify it in CMAKE_CLAW_CLAWCONFIG_EXECUTABLE.") ENDIF(CMAKE_CLAW_CLAWCONFIG_EXECUTABLE) MARK_AS_ADVANCED(CMAKE_CLAW_CLAWCONFIG_EXECUTABLE) ENDIF(UNIX) IF(WIN32) FIND_PATH(CLAW_ROOT_DIRECTORY "include/claw/application.hpp" "C:/claw/" "D:/claw/" "C:/Program Files/claw/" "D:/Program Files/claw/" ) SET( CLAW_INCLUDE_DIRECTORY "${CLAW_ROOT_DIRECTORY}/include" ) SET( CLAW_LINK_DIRECTORY "${CLAW_ROOT_DIRECTORY}/lib" ) FIND_PATH( CLAW_CONFIG_WIN_CXXFILE "win/definitions.txt" "${CLAW_ROOT_DIRECTORY}" ) IF( CLAW_CONFIG_WIN_CXXFILE ) FILE( READ "${CLAW_CONFIG_WIN_CXXFILE}/win/definitions.txt" CLAW_DEFINITIONS ) ENDIF( CLAW_CONFIG_WIN_CXXFILE ) ENDIF(WIN32) IF( CLAW_INCLUDE_DIRECTORY AND CLAW_LINK_DIRECTORY AND CLAW_DEFINITIONS ) SET(CLAW_FOUND 1) ELSE( CLAW_INCLUDE_DIRECTORY AND CLAW_LINK_DIRECTORY AND CLAW_DEFINITIONS ) SET(CLAW_FOUND 0) ENDIF( CLAW_INCLUDE_DIRECTORY AND CLAW_LINK_DIRECTORY AND CLAW_DEFINITIONS ) #------------------------------------------------------------------------------- # claw_logger FIND_LIBRARY( CLAW_LOGGER_LIBRARIES NAMES claw_logger PATHS ${CLAW_LINK_DIRECTORY} ) IF( NOT CLAW_LOGGER_LIBRARIES ) MESSAGE( FATAL_ERROR "Could not find claw_logger library" ) SET(CLAW_FOUND 0) ENDIF( NOT CLAW_LOGGER_LIBRARIES ) #------------------------------------------------------------------------------- # claw_application FIND_LIBRARY( CLAW_APPLICATION_LIB NAMES claw_application PATHS ${CLAW_LINK_DIRECTORY} ) IF( NOT CLAW_APPLICATION_LIB ) MESSAGE( FATAL_ERROR "Could not find claw_application library" ) SET(CLAW_FOUND 0) ELSE( NOT CLAW_APPLICATION_LIB ) SET( CLAW_APPLICATION_LIBRARIES ${CLAW_APPLICATION_LIB} ${CLAW_LOGGER_LIBRARIES} ) ENDIF( NOT CLAW_APPLICATION_LIB ) #------------------------------------------------------------------------------- # claw_configuration_file FIND_LIBRARY( CLAW_CONFIGURATION_FILE_LIBRARIES NAMES claw_configuration_file PATHS ${CLAW_LINK_DIRECTORY} ) IF( NOT CLAW_CONFIGURATION_FILE_LIBRARIES ) MESSAGE( FATAL_ERROR "Could not find claw_configuration_file library" ) SET(CLAW_FOUND 0) ENDIF( NOT CLAW_CONFIGURATION_FILE_LIBRARIES ) #------------------------------------------------------------------------------- # claw_dynamic_library FIND_LIBRARY( CLAW_DYNAMIC_LIBRARY_LIB NAMES claw_dynamic_library PATHS ${CLAW_LINK_DIRECTORY} ) IF( NOT CLAW_DYNAMIC_LIBRARY_LIB ) MESSAGE( FATAL_ERROR "Could not find claw_dynamic_library library" ) SET(CLAW_FOUND 0) ELSE( NOT CLAW_DYNAMIC_LIBRARY_LIB ) SET( CLAW_DYNAMIC_LIBRARY_LIBRARIES ${CLAW_DYNAMIC_LIBRARY_LIB} ) IF(UNIX) SET( CLAW_DYNAMIC_LIBRARY_LIBRARIES ${CLAW_DYNAMIC_LIBRARY_LIBRARIES} ${CMAKE_DL_LIBS} ) ENDIF(UNIX) ENDIF( NOT CLAW_DYNAMIC_LIBRARY_LIB ) #------------------------------------------------------------------------------- # claw_graphic FIND_LIBRARY( CLAW_GRAPHIC_LIB NAMES claw_graphic PATHS ${CLAW_LINK_DIRECTORY} ) IF( NOT CLAW_GRAPHIC_LIB ) MESSAGE( FATAL_ERROR "Could not find claw_graphic library" ) SET(CLAW_FOUND 0) ELSE( NOT CLAW_GRAPHIC_LIB ) SET( CLAW_GRAPHIC_LIBRARIES ${CLAW_GRAPHIC_LIB} ) STRING( REGEX MATCH "CLAW_JPEG_SUPPORT" CLAW_CONFIG_USES_JPEG "${CLAW_DEFINITIONS}" ) STRING( REGEX MATCH "CLAW_PNG_SUPPORT" CLAW_CONFIG_USES_PNG "${CLAW_DEFINITIONS}" ) IF ( CLAW_CONFIG_USES_JPEG ) INCLUDE(FindJPEG) IF( JPEG_FOUND ) SET( CLAW_GRAPHIC_LIBRARIES ${CLAW_GRAPHIC_LIBRARIES} ${JPEG_LIBRARIES} ) SET( CLAW_GRAPHIC_INCLUDE_DIRECTORY ${CLAW_GRAPHIC_INCLUDE_DIRECTORY} ${JPEG_INCLUDE_DIR} ) SET( CLAW_GRAPHIC_LINK_DIRECTORY ${CLAW_GRAPHIC_LINK_DIRECTORY} ${JPEG_LIBRARY} ) ELSE( JPEG_FOUND ) SET( CLAW_FOUND 0 ) ENDIF( JPEG_FOUND ) ENDIF( CLAW_CONFIG_USES_JPEG ) IF ( CLAW_CONFIG_USES_PNG ) INCLUDE(FindPNG) IF( PNG_FOUND ) SET( CLAW_GRAPHIC_LIBRARIES ${CLAW_GRAPHIC_LIBRARIES} ${PNG_LIBRARIES} ) SET( CLAW_GRAPHIC_INCLUDE_DIRECTORY ${CLAW_GRAPHIC_INCLUDE_DIRECTORY} ${PNG_INCLUDE_DIR} ) SET( CLAW_GRAPHIC_LINK_DIRECTORY ${CLAW_GRAPHIC_LINK_DIRECTORY} ${PNG_LIBRARY} ) ELSE( PNG_FOUND ) SET( CLAW_FOUND 0 ) ENDIF( PNG_FOUND ) ENDIF( CLAW_CONFIG_USES_PNG ) ENDIF( NOT CLAW_GRAPHIC_LIB ) #------------------------------------------------------------------------------- # claw_net FIND_LIBRARY( CLAW_NET_LIB NAMES claw_net PATHS ${CLAW_LINK_DIRECTORY} ) IF( NOT CLAW_NET_LIB ) MESSAGE( FATAL_ERROR "Could not find claw_net library" ) SET(CLAW_FOUND 0) ELSE( NOT CLAW_NET_LIB ) SET( CLAW_NET_LIBRARIES ${CLAW_NET_LIB} ) IF(WIN32) FIND_LIBRARY( CLAW_WSOCK32_LIB NAMES wsock32 ) IF( NOT CLAW_WSOCK32_LIB ) MESSAGE( FATAL_ERROR "Could not find wsock32 library" ) SET(CLAW_FOUND 0) ELSE( NOT CLAW_WSOCK32_LIB ) SET( CLAW_NET_LIBRARIES ${CLAW_NET_LIBRARIES} ${CLAW_WSOCK32_LIB} ) ENDIF( NOT CLAW_WSOCK32_LIB ) ENDIF(WIN32) ENDIF( NOT CLAW_NET_LIB ) #------------------------------------------------------------------------------- # claw_tween FIND_LIBRARY( CLAW_TWEEN_LIB NAMES claw_tween PATHS ${CLAW_LINK_DIRECTORY} ) IF( NOT CLAW_TWEEN_LIB ) MESSAGE( FATAL_ERROR "Could not find claw_tween library" ) SET(CLAW_FOUND 0) ELSE( NOT CLAW_TWEEN_LIB ) SET( CLAW_TWEEN_LIBRARIES ${CLAW_TWEEN_LIB} ) INCLUDE(FindBoost) FIND_PACKAGE( Boost 1.42 ) IF( NOT Boost_FOUND ) MESSAGE( FATAL_ERROR "Can't find Boost library on version greater or equal to 1.42 on your system." ) SET( CLAW_FOUND 0 ) ENDIF( NOT Boost_FOUND ) ENDIF( NOT CLAW_TWEEN_LIB ) #------------------------------------------------------------------------------- MARK_AS_ADVANCED( CLAW_DEFINITIONS CLAW_INCLUDE_DIRECTORY CLAW_LINK_DIRECTORY CLAW_APPLICATION_LIB CLAW_DYNAMIC_LIBRARY_LIB CLAW_GRAPHIC_LIB CLAW_NET_LIB CLAW_WSOCK32_LIB CLAW_CONFIG_USES_JPEG CLAW_CONFIG_USES_PNG CLAW_GRAPHIC_INCLUDE_DIRECTORY CLAW_GRAPHIC_LINK_DIRECTORY CLAW_LOGGER_LIBRARIES CLAW_APPLICATION_LIBRARIES CLAW_CONFIGURATION_FILE_LIBRARIES CLAW_DYNAMIC_LIBRARY_LIBRARIES CLAW_GRAPHIC_LIBRARIES CLAW_NET_LIBRARIES ) IF( CLAW_FOUND ) SET(CLAW_MAJOR_VERSION 0) SET(CLAW_MINOR_VERSION 0) SET(CLAW_RELEASE_NUMBER 0) SET(CLAW_REVISION_NUMBER 0) FILE( READ "${CLAW_INCLUDE_DIRECTORY}/claw/version.hpp" _CLAW_VERSION_HPP_CONTENTS ) STRING( REGEX REPLACE ".*#define CLAW_MAJOR_VERSION ([0-9]+).*" "\\1" CLAW_MAJOR_VERSION "${_CLAW_VERSION_HPP_CONTENTS}" ) STRING( REGEX REPLACE ".*#define CLAW_MINOR_VERSION ([0-9]+).*" "\\1" CLAW_MINOR_VERSION "${_CLAW_VERSION_HPP_CONTENTS}" ) STRING( REGEX REPLACE ".*#define CLAW_RELEASE_NUMBER ([0-9]+).*" "\\1" CLAW_RELEASE_NUMBER "${_CLAW_VERSION_HPP_CONTENTS}" ) STRING( REGEX REPLACE ".*#define CLAW_REVISION_NUMBER ([0-9]+).*" "\\1" CLAW_REVISION_NUMBER "${_CLAW_VERSION_HPP_CONTENTS}" ) SET( CLAW_VERSION "${CLAW_MAJOR_VERSION}.${CLAW_MINOR_VERSION}.${CLAW_RELEASE_NUMBER}" ) IF( NOT CLAW_FIND_QUIETLY ) MESSAGE(STATUS "Found Claw library version ${CLAW_VERSION}") ENDIF( NOT CLAW_FIND_QUIETLY ) ELSE( CLAW_FOUND ) MESSAGE(FATAL_ERROR "Could not find Claw library") ENDIF( CLAW_FOUND ) libclaw-1.7.4/cmake_uninstall.cmake.in000066400000000000000000000015551216507631600177350ustar00rootroot00000000000000IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) STRING(REGEX REPLACE "\n" ";" files "${files}") FOREACH(file ${files}) MESSAGE(STATUS "Uninstalling \"${file}\"") IF(EXISTS "${file}") EXEC_PROGRAM( "@CMAKE_COMMAND@" ARGS "-E remove \"${file}\"" OUTPUT_VARIABLE rm_out RETURN_VALUE rm_retval ) IF("${rm_retval}" STREQUAL 0) ELSE("${rm_retval}" STREQUAL 0) MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"") ENDIF("${rm_retval}" STREQUAL 0) ELSE(EXISTS "${file}") MESSAGE(STATUS "File \"${file}\" does not exist.") ENDIF(EXISTS "${file}") ENDFOREACH(file) libclaw-1.7.4/desktop/000077500000000000000000000000001216507631600146205ustar00rootroot00000000000000libclaw-1.7.4/desktop/CMakeLists.txt000066400000000000000000000000221216507631600173520ustar00rootroot00000000000000subdirs( locale ) libclaw-1.7.4/desktop/locale/000077500000000000000000000000001216507631600160575ustar00rootroot00000000000000libclaw-1.7.4/desktop/locale/CMakeLists.txt000066400000000000000000000001411216507631600206130ustar00rootroot00000000000000include( FindGettext OPTIONAL ) if( GETTEXT_FOUND ) subdirs( libclaw ) endif( GETTEXT_FOUND ) libclaw-1.7.4/desktop/locale/libclaw/000077500000000000000000000000001216507631600174745ustar00rootroot00000000000000libclaw-1.7.4/desktop/locale/libclaw/CMakeLists.txt000066400000000000000000000025351216507631600222410ustar00rootroot00000000000000# replace the GETTEXT_CREATE_TRANSLATIONS macro to allow to specify the target # name. So we can have translations in several subdirectories. macro(GETTEXT_CREATE_TRANSLATIONS_CUSTOM _targetName _potFile _firstPoFile) set(_gmoFiles) get_filename_component(_potBasename ${_potFile} NAME_WE) get_filename_component(_absPotFile ${_potFile} ABSOLUTE) FOREACH (_currentPoFile ${_firstPoFile} ${ARGN}) get_filename_component(_absFile ${_currentPoFile} ABSOLUTE) get_filename_component(_abs_PATH ${_absFile} PATH) get_filename_component(_lang ${_absFile} NAME_WE) set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo) add_custom_command( OUTPUT ${_gmoFile} COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile} DEPENDS ${_absPotFile} ${_absFile} ) install( FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo ) set(_gmoFiles ${_gmoFiles} ${_gmoFile}) ENDFOREACH (_currentPoFile ) add_custom_target(${_targetName} ALL DEPENDS ${_gmoFiles}) endmacro(GETTEXT_CREATE_TRANSLATIONS_CUSTOM) gettext_create_translations_custom( libclaw-translations libclaw.pot fr.po ) libclaw-1.7.4/desktop/locale/libclaw/extract-strings.sh000066400000000000000000000003701216507631600231710ustar00rootroot00000000000000#!/bin/sh xgettext --output=libclaw.pot --c++ --trigraphs --sort-output \ --keyword=claw_gettext --keyword=claw_ngettext:1,2 \ ../../../claw/code/*.cpp for f in *.po do msgmerge --update --previous --backup=none "$f" libclaw.pot done libclaw-1.7.4/desktop/locale/libclaw/fr.po000066400000000000000000000050531216507631600204460ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: 1.5\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-09-13 22:27+0200\n" "PO-Revision-Date: 2010-09-13 22:28+0100\n" "Last-Translator: Julien Jorge \n" "Language-Team: Français \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #: ../../../claw/code/log_stream_uniq.cpp:103 msgid " time)" msgid_plural " times)" msgstr[0] " fois)" msgstr[1] " fois)" #: ../../../claw/code/log_stream_uniq.cpp:102 msgid "(Previous line repeated " msgstr "(La ligne prĂŠcĂŠdente est rĂŠpĂŠtĂŠe " #: ../../../claw/code/arguments.cpp:42 msgid "" msgstr "" #: ../../../claw/code/application.cpp:58 msgid "" "Level of log informations:\n" "\t\terror: error messages,\n" "\t\twarning: warning and error messages,\n" "\t\tverbose: all messages." msgstr "" "Niveau des informations de journalisation :\n" "\t\terreur : messages d'erreur ;\n" "\t\tavertissement : messages d'avertissement et d'erreur ;\n" "\t\tverbeux : tous les messages." #: ../../../claw/code/application.cpp:54 msgid "The file to use to store log informations." msgstr "Le fichier dans le quel seront stockĂŠs les messages de journalisation." #: ../../../claw/code/application.cpp:70 msgid "" "Use a logger that does not output messages that have been recently output." msgstr "" "Utilise un système de journalisation qui omet les messages rĂŠcemment " "affichĂŠs." #: ../../../claw/code/application.cpp:65 msgid "Use a logger that does not output successively the same message." msgstr "" "Utilise un système de journalisation qui n'affiche pas le mĂŞme message " "plusieurs fois successivement." #: ../../../claw/code/application.cpp:97 msgid "error" msgstr "erreur" #: ../../../claw/code/log_level.cpp:36 msgid "error: " msgstr "erreur : " #: ../../../claw/code/application.cpp:55 msgid "file" msgstr "fichier" #: ../../../claw/code/application.cpp:71 msgid "integer" msgstr "entier" #: ../../../claw/code/application.cpp:61 msgid "string" msgstr "chaĂŽne de caractères" #: ../../../claw/code/application.cpp:101 msgid "verbose" msgstr "verbeux" #: ../../../claw/code/application.cpp:99 msgid "warning" msgstr "avertissement" #: ../../../claw/code/log_level.cpp:37 msgid "warning: " msgstr "avertissement : " libclaw-1.7.4/desktop/locale/libclaw/libclaw.pot000066400000000000000000000037061216507631600216430ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-09-13 22:27+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" #: ../../../claw/code/log_stream_uniq.cpp:103 msgid " time)" msgid_plural " times)" msgstr[0] "" msgstr[1] "" #: ../../../claw/code/log_stream_uniq.cpp:102 msgid "(Previous line repeated " msgstr "" #: ../../../claw/code/arguments.cpp:42 msgid "" msgstr "" #: ../../../claw/code/application.cpp:58 msgid "" "Level of log informations:\n" "\t\terror: error messages,\n" "\t\twarning: warning and error messages,\n" "\t\tverbose: all messages." msgstr "" #: ../../../claw/code/application.cpp:54 msgid "The file to use to store log informations." msgstr "" #: ../../../claw/code/application.cpp:70 msgid "" "Use a logger that does not output messages that have been recently output." msgstr "" #: ../../../claw/code/application.cpp:65 msgid "Use a logger that does not output successively the same message." msgstr "" #: ../../../claw/code/application.cpp:97 msgid "error" msgstr "" #: ../../../claw/code/log_level.cpp:36 msgid "error: " msgstr "" #: ../../../claw/code/application.cpp:55 msgid "file" msgstr "" #: ../../../claw/code/application.cpp:71 msgid "integer" msgstr "" #: ../../../claw/code/application.cpp:61 msgid "string" msgstr "" #: ../../../claw/code/application.cpp:101 msgid "verbose" msgstr "" #: ../../../claw/code/application.cpp:99 msgid "warning" msgstr "" #: ../../../claw/code/log_level.cpp:37 msgid "warning: " msgstr "" libclaw-1.7.4/doc/000077500000000000000000000000001216507631600137145ustar00rootroot00000000000000libclaw-1.7.4/doc/CMakeLists.txt000066400000000000000000000007711216507631600164610ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw) include( ${CMAKE_ROOT}/Modules/FindDoxygen.cmake OPTIONAL ) if( DOXYGEN_FOUND ) add_custom_target( doc ALL "${DOXYGEN_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile" ) file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html") # install documentation install( DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" DESTINATION ${CLAW_INSTALLDIR_DOC} ) else( DOXYGEN_FOUND ) message( "doxygen not found." ) endif( DOXYGEN_FOUND ) libclaw-1.7.4/doc/Doxyfile000066400000000000000000002303111216507631600154220ustar00rootroot00000000000000# Doxyfile 1.8.1.2 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # # All text after a hash (#) is considered a comment and will be ignored. # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" "). #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or sequence of words) that should # identify the project. Note that if you do not use Doxywizard you need # to put quotes around the project name if it contains spaces. PROJECT_NAME = "Claw" # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = 1.7.3 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer # a quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify an logo or icon that is # included in the documentation. The maximum height of the logo should not # exceed 55 pixels and the maximum width should not exceed 200 pixels. # Doxygen will copy the logo to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = "The $name class" \ "The $name widget" \ "The $name file" \ is \ provides \ specifies \ contains \ represents \ a \ an \ the # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = ../claw/ # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful if your file system # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 2 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding # "class=itcl::class" will allow you to use the command class in the # itcl::class meaning. TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this # tag. The format is ext=language, where ext is a file extension, and language # is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, # C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make # doxygen treat .inc files as Fortran files (default is PHP), and .f files as C # (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions # you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all # comments according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you # can mix doxygen, HTML, and XML commands with Markdown formatting. # Disable only in case of backward compatibilities issues. MARKDOWN_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also makes the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and # unions are shown inside the group in which they are included (e.g. using # @ingroup) instead of on a separate page (for HTML and Man pages) or # section (for LaTeX and RTF). INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and # unions with only public data fields will be shown inline in the documentation # of the scope in which they are defined (i.e. file, namespace, or group # documentation), provided this scope is documented. If set to NO (the default), # structs, classes, and unions are shown on a separate page (for HTML and Man # pages) or section (for LaTeX and RTF). INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penalty. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will roughly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols. SYMBOL_CACHE_SIZE = 0 # Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be # set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given # their name and scope. Since this can be an expensive process and often the # same symbol appear multiple times in the code, doxygen keeps a cache of # pre-resolved symbols. If the cache is too small doxygen will become slower. # If the cache is too large, memory is wasted. The cache size is given by this # formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation. EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = NO # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespaces are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to # do proper type resolution of all parameters of a function it will reject a # match between the prototype and the implementation of a member function even # if there is only one candidate or it is obvious which candidate to choose # by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen # will still accept a match between prototype and implementation in such cases. STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or macro consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and macros in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # requires the bibtex tool to be installed. See also # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this # feature you need bibtex and perl available in the search path. CITE_BIB_FILES = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = NO # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_NO_PARAMDOC option can be enabled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = ../claw \ ./doc-src # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = *.c \ *.cc \ *.cxx \ *.cpp \ *.tpp \ *.c++ \ *.d \ *.java \ *.ii \ *.ixx \ *.ipp \ *.i++ \ *.inl \ *.h \ *.hh \ *.hxx \ *.hpp \ *.h++ \ *.idl \ *.odl \ *.cs \ *.php \ *.php3 \ *.inc \ *.m \ *.mm \ *.dox \ *.C \ *.CC \ *.C++ \ *.II \ *.I++ \ *.H \ *.HH \ *.H++ \ *.CS \ *.PHP \ *.PHP3 \ *.M \ *.MM # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = ../examples # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = * # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = ./doc-img/ # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty or if # non of the patterns match the file name, INPUT_FILTER is applied. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) # and it is also possible to disable source filtering for a specific pattern # using *.ext= (so without naming a filter). This option only has effect when # FILTER_SOURCE_FILES is enabled. FILTER_SOURCE_PATTERNS = #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C, C++ and Fortran comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. Note that when using a custom header you are responsible # for the proper inclusion of any scripts and style sheets that doxygen # needs, which is dependent on the configuration options used. # It is advised to generate a default header using "doxygen -w html # header.html footer.html stylesheet.css YourConfigFile" and then modify # that header. Note that the header is subject to change so you typically # have to redo this when upgrading to a newer version of doxygen or when # changing the value of configuration settings such as GENERATE_TREEVIEW! HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # style sheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that # the files will be copied as-is; there are no commands or markers available. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, # see http://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of # the colors in the HTML output. For a value of 0 the output will use # grayscales only. A value of 255 will produce the most vivid colors. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to # the luminance component of the colors in the HTML output. Values below # 100 gradually make the output lighter, whereas values above 100 make # the output darker. The value divided by 100 is the actual gamma applied, # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, # and 100 does not change the gamma. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. HTML_DYNAMIC_SECTIONS = NO # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of # entries shown in the various tree structured indices initially; the user # can expand and collapse entries dynamically later on. Doxygen will expand # the tree to such a level that at most the specified number of entries are # visible (unless a fully collapsed tree already exceeds this amount). # So setting the number of entries 1 will produce a full collapsed tree by # default. 0 is a special value representing an infinite number of entries # and will result in a full expanded tree by default. HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated # that can be used as input for Qt's qhelpgenerator to generate a # Qt Compressed Help (.qch) of the generated HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see # # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. # # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) # at top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. Since the tabs have the same information as the # navigation tree you can set this option to NO if you already set # GENERATE_TREEVIEW to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. # Since the tree basically has the same information as the tab index you # could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = NO # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # (range [0,1..20]) that doxygen will group on one line in the generated HTML # documentation. Note that a value of 0 will completely suppress the enum # values from appearing in the overview section. ENUM_VALUES_PER_LINE = 4 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open # links to external symbols imported via tag files in a separate window. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are # not supported properly for IE 6.0, but are supported on all modern browsers. # Note that when changing this option you need to delete any form_*.png files # in the HTML output before the changes have effect. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax # (see http://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you may also need to install MathJax separately and # configure the path to it using the MATHJAX_RELPATH option. USE_MATHJAX = NO # When MathJax is enabled you need to specify the location relative to the # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to # the MathJax Content Delivery Network so you can quickly see the result without # installing MathJax. # However, it is strongly recommended to install a local # copy of MathJax from http://www.mathjax.org before deployment. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension # names that should be enabled during MathJax rendering. MATHJAX_EXTENSIONS = # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = NO # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a PHP enabled web server instead of at the web client # using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server # based approach is that it scales better to large projects and allows # full text search. The disadvantages are that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for # the generated latex document. The footer should contain everything after # the last chapter. If it is left blank doxygen will generate a # standard footer. Notice: only use this tag if you know what you are doing! LATEX_FOOTER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See # http://en.wikipedia.org/wiki/BibTeX for more info. LATEX_BIB_STYLE = plain #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load style sheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # pointed to by INCLUDE_PATH will be searched when a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition that # overrules the definition found in the source code. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all references to function-like macros # that are alone on a line, have an all uppercase name, and do not end with a # semicolon, because these will confuse the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. For each # tag file the location of the external documentation should be added. The # format of a tag file without this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths # or URLs. Note that each tag file must have a unique name (where the name does # NOT include the path). If a tag file is not located in the directory in which # doxygen is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) doxygen will # base this on the number of processors available in the system. You can set it # explicitly to a value larger than 0 to get control over the balance # between CPU load and processing speed. DOT_NUM_THREADS = 0 # By default doxygen will use the Helvetica font for all dot files that # doxygen generates. When you want a differently looking font you can specify # the font name using DOT_FONTNAME. You need to make sure dot is able to find # the font, which can be done by putting it in a standard location or by setting # the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the # directory containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the Helvetica font. # If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to # set the path where dot can find it. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If the UML_LOOK tag is enabled, the fields and methods are shown inside # the class node. If there are many fields or methods and many nodes the # graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS # threshold limits the number of items for each type to make the size more # managable. Set this to 0 for no limit. Note that the threshold may be # exceeded by 50% before the limit is enforced. UML_LIMIT_NUM_FIELDS = 10 # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are svg, png, jpg, or gif. # If left blank png will be used. If you choose svg you need to set # HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible in IE 9+ (other browsers do not have this requirement). DOT_IMAGE_FORMAT = png # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. # Note that this requires a modern browser other than Internet Explorer. # Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you # need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible. Older versions of IE do not have SVG support. INTERACTIVE_SVG = NO # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the # \mscfile command). MSCFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 1000 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES libclaw-1.7.4/doc/doc-img/000077500000000000000000000000001216507631600152335ustar00rootroot00000000000000libclaw-1.7.4/doc/doc-img/tween/000077500000000000000000000000001216507631600163555ustar00rootroot00000000000000libclaw-1.7.4/doc/doc-img/tween/back-in.png000066400000000000000000000034301216507631600203670ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹AIDATxÚíiLWŔë*xŕ‚PEQA…ZŤąÖJ<kB/ŁMÚ/öĐŚMľŃ6­ib4ƜќĄ­GbSۘjäCIŹŇzŐŁŠ'Ľ VA9eeËąL?ü!¨…ݝݙa 2yĚoç˝yçŘ4MÓP Ý:ű˘„X̅rŘu]íjÝÉĘĘÂĺry›ŽÂGVN%ßAőűn˙˙q›*CŹŁ´†l‚ţĄp}„´#DeYňóepi0?Ą} „XĘî<Ů.Ję8Œb7jáč?00fÄuN ąˆ˝ůĐÔě>ť%Ä2˛‹dë.ť%Äš5ř­z…ŔĚáîĂ*!đK8ŕ™aěáŽ+!°óźlgóV 1™j'ěš,ůKɞĂ+!&łŻę]0/„zŻ„˜Ěś\ŮfŒń.źb"×îŔ‘kĐŻ'Ěé]%ÄDžż mW GCh°wq”iÍŽ^Mő>Žb‡ŻÁ_ˇaä˜4ŘűxJˆIdž–í’ń`×q—•¨¨“ž{7X<^_\%Äv]„şF˜; bű苫„˜ŔW§dűúýq•ƒšX—+!.ž×_ 1˜Önڌą`ˇéŻ„H˝ śŸ“}OQĄ„HV”ÔŔ˜Hö- %Ä 4`KKažlř[Jˆaü^ÜÖMť$Ĺ÷t”ƒŘ|Rś+Ň gďé(!pţěɇîvxs’i)!°ĺ”Œ,Yš aţĽĽ„řII ě8 Ýlđî“ţ§§„řIćŠ<—ńýüOO ńƒj'|qBöWN3&M%Äśž•p3â`‚ŽN(w(!>ŇÔ _śTWNó˝"ř0Jˆüx ŽTCâ@˜5Ü˙ôZQB|ŔŮkÉţň4ßZu;B ńĚÓPP CúÂŇcÓVBtRĺ„uGd}şűÉ7ž „čäłăpÓ)Qđź}îPBtPR#BlŔŚŮƖ­(!:x+[ęéńî'núƒâ%ŮE°Ż@Zt7Ď1ď=,NëÓᅱ}E]THS3|p6“˙×§3.׺œťőR€ď+h{2Et1!WŞaÁ.Y?Äß̓—ÇuöU=HŔŽs2+ś„ľźîŰeňb\8ô+š_Ÿ†UżÂzˆ ƒ}0٢C=Ř4MӖgĂç'<„Źżeš Ž!)BdMyLú˜™ŰNXu<‚ňţSœđFĚIěŽŇNťŚäädâăŰ_UŔŚišćҤ†ÚJEä•CőżŇœpŠÎ”É i÷Ó;ž,łG@r¤üúşF™Ů´ń¸ĺ€ARű^6‚ře_×ç*jDTîMY‹öt)”9d:HƒÜž0g¤‡éCey;+:vZš× ŮӆŁpŤĺG–™sĺ‡čřýýżŤeJp^¸*k}45ˇî%ŁĂ'ÇBZ ¤D›3ŔěěMYÖâŰ\y"†5Óa~˘qÓĚĆđş”߃ýWŕĎRšI‡Jڞ €¨^Ň?=&’ZţRŁ ,Dßyޝň¤ć‹ˆüĘścŠQđŃS07ÁÚ§ÓL˙ŽŁAĘ ƒWĺćĺUČŘXWóƒá††‹œîv5@Ţö†ôm;^X÷áRš¤Qćx0~â@kť(IZkU:ĺ“GUNÎî–ĚńÎŤGƒt›z"Ś7ŒŽ'-5JÖIŽěŒŰg<ő *—&_/+­•őĂ “—„îv°=bY‘ˇ”…j~8ţňćÍ@&žü%tEXtdate:create2011-06-10T22:30:45+02:00€n%tEXtdate:modify2011-06-10T22:30:45+02:00bÝ˝ŇIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/back-inout.png000066400000000000000000000034731216507631600211260ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹dIDATxÚíkPTUŔť ňđ˘ †ŠŚ‚Ě™J{ŻF--5˛郙}đK5eN_Źl2­q25Ç´‡MM6Nš:Ö(™‚:>Ây.ňŘۇ? !)°ťœ{îň›Ůšg/ťđŸűăÜsĎŰf†A'ŚÁŽ:€Nţ‹ŸęĚH ˛ŠĄŚ^ŽŽ&÷Aaŕ˝ Ŕ WŻSHő¤_‚í'áëSP\uçĎ;lńá0:ĆÇŔƒ÷@°ż{qŘ:ËŘů,ß' Ď=ÜŚ‚ˆŽĐ§řŰáR”TĂé"8U§˙Ňß ňƒ1}ab,ŒŠ„ÉqĐ# mąř´ÂJXş vœ–÷QÝaé8x&^nM­áďk°7\€špĽźńg6$„K.ЇŘč,Żą}ÁŃB ~KHjj*őőőŞŻQ‡‘WÄű“š\˜Ňý8sŁsră&î2$Ľ_qp-,‰Ťö˛ŠĄěĆíŸ-y Bo?ď“9ä@.ĚţŠňŸťő)¸/Ę;ŤÎyePZ-šŠÎ%çg“‡ƒćřœýš0ý+¨¨ąŃ:OĘłŕSBÎCŇF(qBĘ@Ř9‚Ü|*ň4>óŘ{ľ Śnă˘a糸U^x Ÿ¨Šť ˜łΗ@˙ІœaBŕ#BÖ˙ űrEBÚ|s•Íąź’jXů›¤×M“§*3cy!ËvĂĺ2 GŠŽćîXZČŢř"üě°azË5cłĄAˆíŁÖŻţ,éĽă¤ńO,+dKŚ4FuƒwQM빤ň°bż¤ßMî]TGÔz,)ä“#Ňę:<ćWM۰œňX}XŇ若܀gf,'äÓ#PT ÷÷…'ŤŽŚíXJˆl9.éUGÓ>,%äPœ)‚Áa0MĂܲí¤&‚ÝŚ:šöa!%Nš]Ům0'^u4íÇ2B6gBeŒôÜKu4íÇ2B6“ă+ăTGâ–rđ"œ˝ BaĘ ŐѸ‡%„|vTŽ/Ńˇ0ż‰öBJŤeäaź0Ru4Ô,ˆ–2˘{¨ŽĆ}´rŤîĄAo`kĐZHaěɖç:ś[ľ„ÖB~8+C3ç$@Wú<î„ÖBž9%Çš Ş#ńÚ )¨úGŻ`xt€ęh<‡śBödC˝ fÜ+źVA[!űsĺ8s¨ęH<‹–B\†ńłĂ„XŐŃx-…˗Ó#ű@Ď@÷Ÿ™ĐRČćL9΢:ĎŁu2IÓFĆëú"Śâ2`I¤_–a=ŰgůVAŢSYyPzí6řr °ŕŕ…Ö˘tmN—!M#Ë÷ÉűľSő]ÁS(â2`qZă„Í7‚—ÇŞžęńé=š/'bCdňK|¸Ź⍑ĺ°d|FöáXő8,KV})́Í0 cqšŹmۜ.čX$…‘)Ű8řľłäqÖÁĆL?ŇŁÂD€^OČ&ŃvBőučPFŒA\\Ë­Ľ6Ă0 g­ĚdÍšל ›•4ź2ňĽö|“čî2j0e ´3Ňß]ĐĹR™œšö[0& >Ÿ‰‘Ş/š¸ëbü׍ĺqôPüš#ˇśŞÚßűŰ!>B6.š'DşX{Cv‰|.#_f:Ýddxk‚lšŇÉí´yw„ę:šŔÇ Ł@rŃšb¨Źý˙ďô ‘Ea%BRŒ”´ŒGśŤ¨­—Mľ.”‚ł‰˜~=ä!Ŕá;ýîâSű‡č€)ję4ň/ÄÓŢ?'œp+%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:45+02:00bÝ˝ŇIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/back-out.png000066400000000000000000000034101216507631600205660ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹1IDATxÚíiLg€ŸE<°\*âą‚ŇCQcŠŐŠÚ66ŠG‹GӚ&ţ MýašřĂ&mľŠMkJmŇÔŚIkkŞhŁ˘ŃZăÝŞ(˘VPPĄ,ȍ ÇNźAVdawżŮÝy’Í|ĚîÂűňě;3ß7ß̚4MÓ0Đ ^Ş0hˇęěAC3\/“eî=°? g ÚÖGŔ‚(˜˙4<7Ź{ż[ÓZ*ʤMP† ŞŰ^ÓŰ &‡Ščéa0c”T‘#ŃĽ Ř}>=ç e]°,…¤˜☿Űd9™Epđ¤Ŕ2‰Ŕd‚ Á*ŐóŇhˆbßt'äNŹÜ űŽÉĎÁž°zŹ||ű8?žĘz8ň·˝špťJāěÓ 1˘ƒ¤šűˁDwЕíY°bÔ4ČžaÍtX/m˝Pő@6mĺI5ʇچöŻ ň•ÍęÄŮěEÁčÁmϡ-Š aÖUŃčeĂłfHÜ"ý„ˆ!°/I:kžŽ!çĚ0{ TÔĂÔ°‰ôž  .ž3Ăě_EĆCFœ*äV%źž Ęë¤22:ŕ4!ˇ*aĆĎPP%ÇŕFeXÇ)Bš,°ôŘă.5d<§YwNܒŃÔƒË lę´ő‹Ă…ʃOŽIű›šîŻ:e}ăP!E5đö.陾ËbU§Ť&ĢAŇN0WCl0|;WuŞŽĂ„|v\†­űyĂď ô5bŤg"$ł֟”öŻÁ8ľŐ vŇhťáA,Œ‚%Ć~Ă&ě.dÝqА _řnžúYކ]…×—˙H{Ó<ôUžëaW!_ü-g˙ćDČćĘŔvě&$ŤRÎșžľ ŞÓr]ě"DÓŕý2főĆ8˜Ş:-×Ĺ.BRłáHžLÓI1:€=˘ÇBš,°ö¨´?N€Ą~ŞSrmz,dS:ä”ÂČAđÁdŐé¸>=RQZs×ĎŸ^ŞÓq}z$äëSPX 1AđćxŐŠ¸ÝR^OK;en÷粴§ŰBžĎ9¸/Ž‚„QŞÓpş%¤É?ž—öÚcźĘžtKČś,™°/ŒT‚{ałMƒ§¤ýa<ô2ĘĂŽŘ,äŕ Č(„?xg˘ęđÝ›…|ŐRɓ Ńď°;6 9[ W đäçU‡îžŘ$dăiŮ‡ŹˆƒANž\ŘS貐k÷`ÇšÂꊪĂv_ş,$%›á­ń0l€ę°Ý—. Šm€Ÿ2Ľ˝fşęÝ›. Ů|^Ε'†ăWĆş2]˛=K–É“T‡ëţ vpAgdK•:f‹ŽIDATxÚíypE‡ż%'„\†Ô@8ŁÄ“CäPAc„€@y …ĺQZŕYĺY(hyZ(ފĺ0А("Š áÄ„Ł’M6;ţńvÍÁ&Ůkvś¤żfvwŚ_ĎţvúMżî~kŇ4MC0t0şŠć]s…â řŠŹ6y:B‚Î>î?A233ihh0şŢ˙;Vv˘0r8;K;Rok|˙ôcăD“ň!úp´îů6Ęëč0H5Ă-ýĄK'¸*‚œ8 ŐdéŔš}0k5TX S, ÷]ĄAퟫ&~.žbpřôčsžëçŤ;ćě8 i"ĆĚKáĂÉěćsŹşC|DÁ)¸â]iŚF&Bf:tużu‡ř€ňZť\ÄÜžK‡ÄŐ1ô H_ ‡ĘĄ÷y°ňvĎĹ%ˆ×,ˇő ié]yJ/Řý7<ň˝ě/ ƒşy_ŚÄ ćo„+ÜÔâ›2• ’s6„¨0xo˜|TŽÄŹ6xh˝8ôyWBˇÎž+[ â˙ ż”Ŕů0¨oËV‚¸IUź¸Mö_%B_˘q“ˇvBQšÄ§îJń}ůJ7¨°Ŕk?ÉţŤăݏSš‚Ä Ţ·˛j˘ÔWJЎÁ’\Ůf¤~v” .ňÉŻpź.ë zëgG â6 ްűއ‡€ÉW˝@'(A\ ď8üQÇŔôKôľĽq÷‘íœËOÝń%Jv8]Ÿý&ű3’őˇ§i‡e?C­nî‰1úŰS‚´Aƒě’ýŽöM%Hl.’É }â`T˘l*AÚŔáĚç^á|–Ą(AZĄ´ Vň™—úĎŽ¤–˙u 0ĽżŒ{ř %H+|śGśs.÷Ż]%ˆ~?!3J"aD˘m+Aœ°ÜŢœuéˇr†¤–ř|t0Á4ăVÎP‚´`ë!Y~6¨›„Úý¤ë d{ç cě+AZ°šHś7÷3Ćž¤ ‡Ęaw)˜ăá˘hcę iŠ˝˛ÝÓ¸:(Aša$Íl\” vŠĘ!˙8t‚ĄW%ˆďţ’É Súé3ÎU” vÖě—mÚ@cëĄABíŰClG¸ŚťąuQ‚ë $Ô>ŠŻŒ‰řÖŃ\řtĺŕœ¤ŞNÂ%B຋Ž„-‡dáć¸$Y/h4çź Žćj˛AąŤ–œÓ‚hŔúB™zŁŽ3ÚÝ!ŕsTÖÉpęŢ2é¸ôŠ…äŽp—Ť_÷”ÂŃ3ň¨ŰՇ+i˝!`Ůő7,ʑ›ĹzöçLňEž2†yęX{@ś7ČÝ(HM˝dHXš'ŻĂƒá63ŒO‚žąPR ?—ŔňÝđc1\űĄ¤Í{k‚űyFc$H@ĺËŞ°Ŕm°ąP&ܙώ€_KÎÔÂł[%ůKUĆ/ÖLs=ßH˝ âCpœzÔč+o$`œú‰jňˆ Y3$e…31˘Ăáőń/ôƒ#gäüŹŽŮË-˙4"úM AJŤ`ô'⸝GBöLi˘\Áš÷Ŕő˝dŮ@ę×°ýhűçĺ‘m t›b¸ ĺľ0ćSY2– ›fKV6wˆ ‡ŹéâK,V˜žRhś…ĂŒ1ptІ bÓ`ęŠF1śĚ†~qž•$I'ÍWúJń-ΨރĹ×Äů œĄ‚źđƒ¤Uí ŤŚĘ: oˆ —r˘Âŕ‡ĂđŘFçÇĺƒę:iŽB o#šcXuJ*ańvŮ{"\íŁqs<|‘*OiKó`SŃŮÇ8ć^MÔ)ƒ7&Čýë¤Ď1ąÜáăőúŔÜ+eIÚÜL¨´4˙<ű t,G&uő­cˆ _ýßü)ÍĹKcôąńňő˛Žźđ4<ššńýjěkÎŁ!)ֈŤoż R] 6ČţÓ#$&ĽĄđŃdÉş°4Of”ä†ú ˇ"^…N˛J]^Űř^t˜´ăˇpžŮů™-ňĎşŔŁĂô˝¸Q‰pwŠŹ|päÜkíţcŘEúÚöˇC'š&őÜI9ň+ ’qiGD6ŽŁÄ žÚ§eţYƒ–ÉqŮłüÓ(­‚KĽŠĘL‡a˙I(ń~\Şć*n rŹfŻj|r‰€GĂԁöŔ_•$¤3WzËV›<Šž6^f“OůR˘ˇŠfX‘ćż‹\źφţ]`ßI‰wíšëçoÚEš ˛ç䓸H¤Ő)ݤç›úľ8ɨ0xr¸dälmŘsoܛ)˜ÜśYd0¨ŕčĺBí|De$-‘äc I–ÜhĐ7Ţ&MÓ´5ű%CóÁÓ­Ř9Tz¸=c`í ůľľ‡Ő ˇÁó[›˛CáĺąţżĐE9đÄ&ˆŐÓ$öˆ˜4MÓćeÁ;ůś—đ!%;‰ śP’Ŕɨ2ö…`i€aÝ뙚Žč0›[FvT÷&ăä%$EÖ0/ö{żŻŰń[§j 2LD1’ääd’’œ?ć™4Mӊ+Äé%Ÿ/Ś–”T‰s4Çťöˇ= Ď ¨*E„ßÍůyIş.Ńň%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:46+02:00S5§OIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/bounce-inout.png000066400000000000000000000041321216507631600214720ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹ƒIDATxÚí}PUuÇ?y J$SIE\ÉMuł1IłuJ›mš˛uýcˇuŰٝĆkÚöĽˇÍˇ&k&-͗,QŰ §P1SLß_0d‘$aAyšÜ{šœţx°Ťë/ ü~÷>3ĚďÜsîÎ÷œßŰyžçŘ Ă0čATĐĂĺŞ6ŔěÔ6Ai-D‡B|8ě8 0+‚z]ůýÉÉÉÁívŤśż[Y_7žj#†Iέ ‹ďxýÂşžě ř)ŃՅĚé_N/›sşáƒňAäÖ§aož˛nÍłăE›UűW ôţ Ô;ĺĘ=ţ+ˆ ó˝~s ¤ż ‡ž÷ěKëóŇ *–큃­Ç&&CďÖßăűĂü4čĺĽĂ°l“uŹJĨj„WwĂҟů^í!Łß đÜDx~;WÂâ<ĎwúFÁ˛,x0Ő÷ßkYAv”I95rKŕŲ=!éęuŤáŮĎeű÷ŕÉ1đřh(Ź€˘ł˛?Ľ7d&AhϰeŮ~ZĘĹă!6><Ů`˙SŇŹ´…<™ĺ 5ž-űŕö~ňs=XrŘë6 żƒŕŽţđöL/'ů‘ Ššíş/l‡GĽî{@H'_Җ¤č,|Wc!,"ƒaő, ”ćköZ%]ŠÓ-ýÒ/ĺóËS!#ąómł¤ y%RNKńěKO€MŮ"Ж0~|V .ř˛T>˙}؀?f‚ŒŽąÍ’ĂŢq+`w9|ýŒ˝ůňcy%Ňlk”Ď!ŕhmÂn ‡e÷Ŕχwm–äL x "Ąě×rĹ˙?5vXuž>îŮ7üFXx[Çć*ׂĺFYŰNɤîîďb€œôEca‘ű,ׇ|rLʙCU[âK bo–QTd0L¨ÚďXJ‚2Y.ÉL‚ˆ`ŐÖxÇR‚Ź;,ĽŽÍXHFŹ9(KÓoQmMŰXFÜy041úGŤśŚm,#ČĘb)缊ś¤},!Hśž€ ¸˜jkÚÇ‚ä—ÜR!&Tľ5íc A.ŽŽćܪڒŤczAÎ5ȂaD0di<şşˆéyëp¸aĆˆRmÍŐ1ľ őNxcl/ŁÚß0ľ ˙*„Ęz“¨śĆ7L+HŁ ţśKś—Ln{Š]7L+ČňBřž~Ňî˘Úß1Ľ gëaižl?7üĺöŔ¤‚ü.OÖ­2“ô^Ůő†éŮrVƒÍodů×Ý&¤˛žÚ,ޅżŁT[ÔqL#HƒZg.ˆbG§uÂ^''ŞáĄ đÍwpCŹÓq'g]đKłŤ!÷”LúöœőGŔ冸0ń>y“j Żżr”ŤsŔ3šđn‘řV]$0˛GŔówB˛ĆO}ÁoŠi‚ťWÂŢ ‰Í›*0‰żŤůs_ń‹&ËŐ3W‹qađŃ\y6nFüBĽů°łLâôśÍ÷ĎᏯh?ě-Ź€żČâŕňéć4Ä0`áV –™;˘kĂtAkAŢŢ/ĂÚŘPřG–jkşmq4{Vl_şK‚eŹ€ś‚źT A˜Ăo’cŤ Ľ ľMđúnŮţó™řY-˙ŐUĹ2œä_Oű:íqňřŕ7ăT[Óýh'ČÎ28|’c`ŚĹîĐPu‡¤\4Ö{śłŁŐżÜܓǎɠc&´¤ Lžře$ÂŔŐÖ¨A+AVIé^ę]…6‚8ݰé¨Ő<Şy”SW˘ ›Ăy‡řŕ&DŞśFÚňţ)­Ü\&‚Ô;áӓ’){„jkÔ˘… ů§ÁÁ’ŃÓĘh!Ȧք0ÓŤśD=ĘqŇĄƒu'ƒ—˘\âJ¨¨“Ěnq]œĚčTŻ{3źľO’ 7şd_r´„<šÁ^RkoŇ<UwÓi‚ü§ćo”+ 1JFOEg%i؊ý°ůá+Ú>=)e B§4YŸŸ’Ä’Ĺ•2Š[3[ňž[ ďÜ'MŃŽ˙Šçam“§Ţy썐Ľö[Ż!žšnAŽTIOť î s‡C/›4QżHçśřpń<źo''îżOĘ ď¤dk.ľ{ăşNƒÝŮë%¸2#r˛˝wĚŁ oD‡HŠď‹Ţ$­ů׳z†ť?r]‚ź˛[úŽžQĐ^LFz,Ÿ!ˆ/î„mßÂĽr'ÝŠiţC´ëýŢÜ"ٝw–I6>˛ř7ޟź!`Ŕëš´nĚöq jÁfxs ‡Ň GŞ> úĐć5]\ }ěyýÂĽL â48%ť§Żb€äLßxTŢßž˝ÂJ‚Œ’ţšŽVyœüŸÜ!}"ŕ™™ ò˝’ ¤ůůÓäŽýÁˆ`X2I|vAŇ^ôŕÁf†ńôÉ ,ŁĄokĺMÓٙj|v™gľ=€ƒ‘S 8‚@G w´ä_ÓţŞq0θ¤Űż šóŞĎCˇ2räHRRRźł†a”_>aHœáp‹Łˇ™u]‹ß„´Y…žé˜füúg5đÎźľ@%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:46+02:00S5§OIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/bounce-out.png000066400000000000000000000041471216507631600211510ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹IDATxÚíypUŐÇ?/y!$¤dK€(‚$C" B)Rd)ŕ22ŽHĆÚ?p§F+ľDK+E”‚ŃTŔČ&Ć"dMbH${Ţťţń˛'dáĺ˝{ďš/ŢĎL朻Ÿsž9Űď,ĎĄiš†eQ›óąš€ÚFhtű÷Źěü6dCe]óën >΃őG ÁŐň;œOZZ.W+w™@UdĂ%áŘSMŇK°şhą‘ő,ęžNŸK}śÁЧł˝ň*şu†äč"BĎ|ETTDô!?"‰œ2šżü1ˆ mţ‡Uꐁ+!ďG…œĐ7ĆÜďď? ׼zsÇѰvŒëwńgĎÖÂěMž+ÇI˝ä}-1 +<:Ą-”O–$§ ^óĎŻO1ďű0}=lɁ[C^9ýAŽ=œ ώQ͟ŤŞ‡×ž‚ePZ NX3îĺ5p´DÎtƒŤťĂ•—´KňÖxp LЇíÇÁÇŇŽ"#ŇsaĘ:IĐ܅Rl>šŢČ—Báîaps< ď)9"ŁVě…ĺňŽäXX5F\XX,!ČěM°îřäI„˙f›—KęaČ*8^OŒ†Ľă˝×vŸ‚•ű$<îVRiŕeđŇďaÚ p8rA\nčą *ęŕěc’0‰o‚Ř7WĘc#Y˛ žţúĹŔˇó%—\HŃOY…•ŢsÎi|¤ô†0ŰŞÎŔ_Ů%PV#•gd'ÖCЇ‚?ŚAĆ)2Œŕ˙Ľđüâ˙űĖň†YW›“Ęű!;OŠ;!Î{ {řú4źřĽ1ßukp˙féwLHP‚rAść‰;ş÷\Ď(X1IüKwI˙Do6} { !&ޜŞ:ź(¤Ţ%gt8$_Đ:šó˜y•üßľ~Ş×ďť'+`އâęFésXĽ‚dˆ‰a|˙ćĺˇH&MßÜaöFi‚Jm#Ěz_ę­äX˜ŸŹ2šŁTOóĹßżĺë1đŢ,wBÚ1)žĄŢ%bdĂ呰~ŚtŘŹ„RA<úďúˇ~ĎČŢŇářËçb˜ó‡ÚF˜ń|”+"üg†˜1ʆ2Ajŕëbč-&…śx ć&‰éÜJŤaüż˝blžn *ćmŁL/  şĆöőíţק½׊(Ú*MV_*úăĺ0ኯb"`˝ç7ą­†2AvŸwŒ‚„:Äp÷ˇ ŇK^s†Ž’ćkKś†˘JX׏‚ƒgÄ8¸űëć ĘL'#Sao‘˜Úukßł;żƒšibŽŠ n$Eߙs°˙ l˓z`z,Ÿ(捣D’*¸|ô˝N<!~ĺܰ<Ö†ěRą‰ý’¨N0y <>Z݀—?(ąeyzçâüÄ ˇh”ü•Ő@NŠ4kzDBüef ĚH”˛9GÜIńúźŻ[g¸áJ1ŃÓ+őęřß čě”›ó1]Ě&sÉŘ~ĐĹb˝d+`ş ˛Ĺ6XuÔ­‰Š‚¸53™L`ÓSÉ*†üł2ŔJ&o+aŞ žâĘέcŞ žţ‡YăÓÁˆi‚d—ČÄąÁÝ á7ŞŁm]Ldc“Đn]ľi‚źTÜۇ¨Ž˛ľ1EcepäąĘ:Ő˛ŁcŠ žYáˇŮ•ůE1EĎdŰvuq ¤źväˌň_N†łiĂy÷ˆXxÇő“ĄW›ś1<‰ÖwN˘ę¨† rň,ě+†^Qvýá+† ˛ćŒuߚœĂŠ*0Lˇď~#ţű†ŤŽfđ`˜ ťOÉbÎ]áşXŐŃ  ä,qLRĹŕÂAJŞdFa¸SŚÚřŽ!‚źsę\09Ţl/ş ŇčöWóF¨Ž^𥝠[ódĹS\WkĎ2ˇ*ş âÉóSdYšMűĐUÓçdűĄ.aśŠÄ_t$użto"Ö]›öŁ› ľ°břďŽ:ZÁ‹n‚ŹÜ'ËŽďíűŞ(›ćč"HeźŇ”;˙ÖŽĚAA<šcdo˜h7u"`A*ëŕĺLń/Ť::ÁOŔ‚źşWĆÍŻˇs‡.$Č÷UđJÓ"ţgÇ곣گ€yr”UKhőÁoAöĘâý°xu’ęhtüDÓ๝Ň+Ÿ“dOŐżyël;.‹óŸł[VşŇnAN”ĂŁŰÄ˙L+ ŰřOťŠm”í‘ÎŐËLÄEŁTżăáł nMö)Ě(KîęiރŢ1ńYĽťd/]gŹ›)#‚6ú㓠KvÁ3Ÿ‰ůD˜2Pu°;.dő~XÜ$Ć_ÇÁ‚ŐAîŘ´şPE-üy;ź}@ŽŚŔÓcTˇăÓLzüó ,ů *ĽÎxęFąUُ ł/[_l8*żT˛eŢ?nQd/Ş`ŔĄišöĐGŢé; E&rˆ”Č|{Փ :”¸¸–Ç*šŚi…•ŢŸćé]#Tů׋ňtą9ť@˛?§GgT, {%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:46+02:00S5§OIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/circ-in.png000066400000000000000000000033431216507631600204120ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹ IDATxÚíklEŔ×öŠ--”G)- RŠEž˘” ˘"ˆ<ŒE‘<"‚1&˜M4ă#’ƒ‰„"¤6–@­P Jm鋈•Ö"Ü]KKi{ĐëÝúáom^{˝ťÝ;zóK63יÝôw3ł3;ťgŇ4MC4„úw˘„LŠ”‚ĂŮ}zDG$//§Óéiš /Ů]ĘńĆTśA\ř˝é˙ Yşti Ď5$ČţhtŸŽš,ƒŠj€‘1÷@÷éJˆÁ4ŘaH”űt%Ä`ţn‚„îӕą´@›’‡¸ĎŁ„ȍ[ŕŇT“4T5H8*Ö}%Ä@,Í>8Ř}%Ä@jš$ŞšŹŕŕL„ăâÜçQB Âá‚_ŽŔđhŐd6hźłGA˜É}>%Ä ~řKšöœO 1ˆÂj • áT5ÄFÂěŃ=çSB  °Z& ć^ţăJˆě+–pÁřŢó*!:Óę€oË " ÖNé=ż˘3_—ŔÍ6xb<ŒÔ{~%DG\|~NâŚyś˘#+ĄÄ‰1°2Íł}”pi°ý¤Äł2zwE Ń‰Ü ¸`…ÄXxy†çű)!:ŕÔŕýB‰ǵhłçű*!:°˙[ )6ÍěŰžJˆŸinƒŹ|‰ge@TDßöWBü̧gáZ3LI€×éűţJˆąśŔÎł˙ř)ĎŻŹş˘„ř‘7N@˝ ϤxW†â'öÉ4ID|śź¨€âŽ4ÁÖß>f&y_–â#mNČ̑U‰cŕÍšž•§„řČĆ<8[+ŤIö,÷Ž#ďŠâ_Ë_Ž€‰Ă|/S ń’2+l9&ńwćÁłüSŽâÖX™#Łňyca[†˙ĘVBúˆÝ!2*ędŽ*w˜Ă}/ˇ%¤Ř°<[V‘ÄDBÁZĺ{š]éăÔWčbo‡e   F‘Ő0)Ţ˙ÇQ5ÄZ°ü‘ GWĂăăô9–Ň övŘ|ň˙Ťy:ĘŐdőˆÝŃŮL…™ ;ćÓ÷˜Jˆ,Í2%rşFšŠěL˙5zB é†R+,Ů57d´ŢÍTW”ť8T ŤsĽšš0ŽŹńϔˆ§(!]xďl?%kŞŒ—fjx´ąç „˙܄—ráÇË`2ÁŚr“)ҏ#pO y!U°á°ô1‘°sŹ÷pŽ„ʐVl+€]礉JWIHBRHąÖ‚óWĺřŤłŕĂ'Ľ†šRo—%žť…[íŇaď{{šBDBBHť ž8/WPךeÔýÂ$ŘľF ô˝|ŇX`ëńÎçħ$ŔîçdíT0Ňo…\°Ęó+ĽÓŽŸ,”'™|]ˆ 'ýNH™ Ţ=)Ďg¸4ëŚÁ[s{~ÇH°Đo„Ô܀NĂŢ"¸í”AÝşŠ"bl\ ĎÎsL÷űťßŤ`ÇŘűť,Z 7Afěxúţ¨ws_Ö—&ÓĘým§&ýBfź=NôzĎ}%ÄŇ,ôŽsŇi kŇaË,Hč3ô ˘iđS­Ô†ü*S€ÂĺĆî 3‡IӓÓ%L‹‡ÉńýóŠHLšŚi›ĘM›žˆ‰”:Ią2;˘Ě€­ę/m–e3î~9FŃIzz:ÉÉÉÝŚ™4MÓj› ŽőÎsřżsÖű ž´ĂPE}烌ĺŤÂ4밌%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:46+02:00S5§OIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/circ-inout.png000066400000000000000000000033411216507631600211400ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹ IDATxÚí}LUeŔ÷ňĄŕЍ ˘‚ŚaiJÓÖÔȕi™nŐŚ}ĚtŤYË6˙ČšÚZłY+‹USŤ-ľĽá×t­ )LĆU”j"• ¨|ˆ\š÷ôÇ#!†™pď}Ď{¸żĂý€çŢßŢóžď9ďó›aALƒ]uA:Ş:+â1ŕšjŽČĎšF¸|ľăkć§AXČżßűÜÜ\<ęϢÇŤáˆ<ŃŁ f-8~ADü߀ąű;ăl=ěpŔÁ?Ŕá‚3—;>עzCBŒ…0;$GCD$Fľż.s„tŇa…܏GŤŕËbřĄL?m Š€ôĄ05f&Á˜Á00˘{˙/؇܂ŞŘxś•Â_—ä1ť Y‰0+ŚĆwŢt‡ 0 (pÂťů°÷4´zÁfƒqCaÁhX’w đo ÁC"bĎix;ŠœňXŸp˜; VN‚Ě။ĽÇˇßŤáĹÝđóYů=&^˜+ď‡!}OŇŕ†Ő çx ˆŽ€ŐSŕ•IŇ:TŃ#YEUđü.iavXœë§ĂđţŞ#ëa-Ä0`]Ź?nÄö…ŻçÁŒ‘Ş#k§ÇšĐËwË\`q:lœ-s 3Ń#„8\đČV™[D„†YŇq›Ë )uÁŒÍPÝi1°íI;DuTˇĆŇBJ]đđ‘1>.•a­™ąŹÇ -C`ŃaŻł&ćHGŽ“ °ŕĂćVxú;‘1N3`A!Ż„C2ŰŢž@/`1!%ŕă"ąÉ„/eęˆîËiő²\9/ľl"<žŞ:˘Ža!  Đ)' ×fŠŽŚëXBHŁŢɗýfA\?ŐuKŮP›aňX’Ž:šîĄ˝|öŤěŻ}H.šęŒöBrË ˛™ÉŞŁé>Ú ůŞDś+&ćĐ\Hm3ě/‡đ˜?Zu4žAk!ÇÎI2/ ˘zŠŽĆ7h-¤źNśł-Đw´a !Š1Ş#ńZ ЏžĐ9UĂsVˇBk!ĺu˛˜-ŞˇęH|‡ÖBNÖ@|”5†ťmh+äl=´´JĐWČe0€” spţzâLź –úm…´°˘ş÷w̆śBĘje{÷@Ցřm…œo”•ë:_Œę ­…D†C?…šţ@K!­^8U #¨ŽÄ÷h)¤ ęš;ć}[-…|^,ŰÉńŞ#ń=Ú irĂΓj—4eŤĄÍżÁĽŤ0-†[l„š q{ŕýòż"Su4ţA+![Kŕϋ˛fwÎ=ŞŁńÚŠn‚7”ý5S}_cÄ,h#dĹ^p5AĆPkvćmh!äˆvœĺ>›Ÿ–U1ýGŤš ˇKŇ˙˙’˘feL-Ä큚ßĘŠöähX3MuDţÇ´B ^;ůĐżěz k–žÖL)ÄV퇏 ĽŠ[Î=XuTÁtB `Ő>ř°PR 6= ǨŽ*p˜Jˆa´Ë°Ű`S6,› :ŞŔbšJľÍđÜNČ=%-ă“lXnŇ1ţÄBň+`юëŐzÂŕÓlX:NuTjP*¤Ő+ɚëó$­ -F&~,:i6” )Ť…gwĘŐ?R }Ë\ˆ Sý•¨%ŕBœőđÖOđM \óÂŔŢŇ_,ŤúŤ0Ňä–ŃÓ{żČőpťMNŽ›î˙âÄ:áw!ŐM°é¨ČhťcŔƒń2ż0se7UřMH‘6Â÷'Ľu€tÖkł ;E˙|ráÓfU đEąÜÎĄ¤Z&zĄvx4^ Y AˇŁ[-¤Á-ˇrŘ^ ygŕDTăYÄśpŒ”ěfÁĹţâ ńRTŇá‚âs°Ż\†Ž-­íŻ™'7*y&ŚÄKÝŞ wF(ŔáJ(Ť‘ęšÁuEÖÎ^ş*‰1—”Îť™”hš™É}Ă`NŞőr5T`3 ĂxiŒ„n&g3 èŹďxŤ›,ľąŰDJŔaÉ2ą:cŞë!Aŕom{ŏ́Î{%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:46+02:00S5§OIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/circ-out.png000066400000000000000000000033451216507631600206150ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹IDATxÚíilTUÇ3Sh)Ľ-ĘŇE Š"‹ˆĄ@~h ’ FƒĆř ÄHÔ`ř`"ˆKDRC"1-&bJmˆˆZś ĽbY ZéŢB÷éóĂĄ-uZč23÷Íź÷K&oéL{ŢűĎšçÝsĎ˝ľhšŚa˘ŹŞ 0銏jź‰ĆVhśĂĺŞÎsˇî@eƒă{WN‚A6Çó‚dffbˇŰU_“ni˛CQ5œ/“›ĚЏż .VB‹ŽÖôţ÷Um„ŕną˜1đŤŐrăóďžÎ݂‚2¸ÓâřŢ!>0.Âüĺ52‚ü`L ř’÷řÚ :¤ëçfŽ[7ĂđM֍Z8Wš7ŕđ% ęMĚˆ †řp˜6&‡C\ śALHżţlÎCÚ48V  ë2äý ÷ށČa0}L{Hˆ—›Ţţmw5^ď!â‡/Aúy8^ ľMň3Ť˘‚ŕé đx¤|űăÂäź*źÖC Ęa>|w^b@;A~łGĂĘxˆur“3PźĘCî4ĂÎ\řć/Ąý›Ë&BR4$Ç€ŻŽŻZÇŚőŽf;d_oóᇿĄşQÎDŽ@j<¤N†é#U[Ů{<śÉŞh€/OÁÇ@IœóąÂÜq°a6,…ą żxœ‡œ˝ťraßŮÎŕœ0^™ +â "@ľ…Ăc<$ż śćŔ÷ňčjł@â8ؔ ˘Ô>9Ý{ČľřŕWŘsZŇƒmđüŁđƓÎď”éÝzČŐęťBœ‘ŔmłŔŞx؞ƊśÎučÎCj›`cV§GXď ńv"<ĄÚ:ףA4MzŇł$ŤjľHŠúů´‚.9U›˛á§‹r<>žN9cT[ć~” ŇŇ&ONۏAk›dU7σ OHĘڈ(¤°V§ĂéRéŔ­M€’e<Áȸ]ťťOŔ[G$€‡ůĂK!%Nő­Đn¤ŽÖ€Ěä8)öŚŔč@ŐˇA?¸MßŠá™2îěë;’áĺŇż0éÄ-‚¤ĺÁúCR•ńp(¤­ńG\*Hkź™;ŽËqJěYÁ~Ş/[ż¸LĘXw~,”NŢŚš°ež¤ČMzĆ%‚”×Ăâ48S*}‹Ż–Ăš)Ş/Ő3pş *`Ő~B€Œ50+RőezNÍöV4ŔÔOáfŒ ŮĎJ “Iďqš‡”×â4cRä<'˘˜ô §„Řö˜‘W*ÍTzŞ)F°‡ÜŔG …ěuRígŇ?ä!­š.bDHĚ0Ĺdý!Č)’ş×#ëĚî ú-ČŽ\I‰X-ppľ)†łč— 'nÂk?Ëţ‡‹ 9Vőex}¤˘A˛ś­R5ţú՗ŕ]ôIť&ă…•RŠ“śĚěšsé“ ťOČ<‹@_‰fÖÖůôZS%qăý…đ˜U”{˝¤Ľ ^̀ŚVX:AFúL\CŻůü¤T‡DŔžsŘՕ vpAgdK•:f‹'IDATxÚí{LŐUŔ?PyhˆšŻTfŠ€Ś-_ůŽRK˘–iś™›ZŤfÚrŽ4‘iVËćŒeŤć–šĺdöPŃVć“45TR‚aňź÷×_HE÷ńűÝ÷|śťűăwĎďœ3>œsîďœďůaŇ4MCá6ř¸şŠťQBœĚšŘzj̍îWœœŒŮlś6_…˜5XxqšŐĄż|ďMóżŘŘXWסŐóăČM…î!ĐŽMăiT—ĺ$4`í19^2ü}O§„8‰”,8üt„—7N q‰Çĺý­ěßt:%Ä d•ŔŽ ôƒ×i>­â>üj,0=ş5ŸV 1˜ĚbŘx|}`ń¨–Ó+!Sß:Ś €¨Î-§WB $ł6§‚É ă­ťF 1CľfD€NÖ]Ł„DV l: ~>°lŒő×)!ą*E&Ÿ‘VŒő(!p:6œďľíZ%ÄVŚ€Eƒ9C 2Üśk•9} ś_”ťň„qś_Ż„č̊Cň>wôąýz%DGNĺAň%iKFۗ‡˘°hŒó†Ę"”=(!:ąů,̂Đx÷1űóQBt ˛ŢŰ/ÇËÇŮß:@ хÄăS*“‡ó‡9–—â 9Ľ2Ł rŘÔZšľ(!ňĆn(­‚‰}dĘQ”ř6’3 ŔÖMŃ'O%ÄNŞÍpPŽWŒ‡6N‘4…b'_œ”¨~ađöýňUBě Ł–î“ăř1ĐĆÁüN”ŠľŔ+ÉpŤžŒ€YƒĎóN”Y÷'¤dKâWSőĎ_ ąŒ"ˆ? ÇÇ@ďú—Ą„XIľćjéŞć 5Ś%ÄJV’`éX+ËłF „XÁĹë°úˆHX ˝B+K iłó–oW3˘ô™i%¤–í‡}KWőţăËSBš!)Mş*€ĎŚ@DGăËTBš ­^M–%مÛßő¤'JH#”TÂłI2­>)ÖLr^ŮJHj-đÂ6¸|… qŕkĐWÜĆPB°öě͔mËŰ_„űƒ[žr)Ů_ʐ8îęü:(!u¤JWUUˇŸĂ¨Š‘–0Чɤá؍_&­âȜڟ´`4^ßB ĘᚤŰ2~›ĺ:ŕĺBňË`â&H/„îÁ°k&tjçÚ:y­’Jxü;şþَEꅟăYx52€×Ë88[‚ÜŻk!5—$÷AţđÓ ÷‘^ÖB Ę!n+ˁöţ2f ëîęZݍ×9›SˇH,nh ě˜ăzťşV÷âBöfÂ3[Ľťz( v̔ww¤Ő Ůrć턊Zˆé [§AX[WתiZ­ Ź<$[,<ÝžŸ.ű˙Ü7Żž}¤Jtá˙‚ X4V?a\¤ˆž´:!Ii˛ŇWZ÷ľ…O'ĂŹAŽŽ•ő´!ľ°üŹ=*‘"1}áë8čéwßśŕńB4 śœ‡Ĺ{ ŻLν9LZ†'tQ ńh!§ň$fęhŽü<¨ ʚąşşföă‘BňËá“#˛űľÖŰÂŇѰ`¸ă›.]G É/ƒ5Gáó˛?Ă̌‚Ä)îâis˝đ!WŠáƒؖ.Ńç á9 ăadW×N_Üv ˇÚ ż\–‘’-çü|ŕŠ~ň`—­LD=nŐB,ȂďRagݒóam%ČyÁpčoĺĂ$=—ś (,‡_ŻŔ‰\řá\˝)ŸůúŔ˜^ňR´;{Nm!%•đ× ™Ú8—/›î3Šnn2ÁŁÝ`Ú@‰ĽídYžŠîB,šü’Ťje‰4˝îuúäŢź÷_ýôď$wŐ1}`TOoďę_‰k1išŚ́KכOhŃäŻűN ĘáF…t3ĽUr.łX䆄H˜MTg.ŻČpčěĺbŇ4M{}7|yŇž ü|äقíÚÜŢęŐ1şXŽBu)”dÓ'¨‚!ž9•aŃŃŃDDD4ú™IÓ4-§Žß˛.łnÁw°&xřÝą;áś÷!ފׅš;˙:†żV,ë˙o%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:46+02:00S5§OIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/cubic-inout.png000066400000000000000000000032771216507631600213150ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹čIDATxÚíYlTU€żé”­ÔZ*RŠ(Gd/ Đ˛$ lF|04‚!˛Š$ŕ‚˘UШ˘Y˜+ČŚ€mQËjc …)”ŇhĄËńáoe›Â3sî˝3ßKĎ˝Ěüwžůϙ{śą)Ľ~ C€îüÜLîŹBy%TVĂŃB9žXů—ę~üˆXźýü˙BRRR¨ŞŞŇ}]Ś ˙2ě̅‹A‘ىŁĹ!ä½Ôý߆ŚN„Řümˆkü‘Ť˛`ă8^7|v›ŮĄC8´‡ćvˆ …F!`ƒ'œ?_ˇ–č¤ÁđWYw ä*Ź=sÓáPœ °Al8ôm ýƒ.‘ĐşŠű^Ó/Ä Eĺđi:|šJŻĘščŚ0öxÁm›{îľýBna}6LüNƒ Đ^î#ëh„ݍ_H ç.‹ˆŐYrÜŽ|5⣽‡_đëqłVž=ŔŒçŕÍ^Đ0ÄűąřźoöJf\ŤGŹH„§#ôĹăłB0yĚĎĽ`tX:ěÁzăňÉŽ$ĽÂź?ĺxV<ŹŠ_řh†LŢt]Ü0­—ăsňE†TS6ĚS $|,Cě–¤š2RfÔâ3˛áLÝ"ĺi˝ŕžş#rŽOt..€Ţ‹Ą° Ć8`Ĺpš 7"–ϐ*ݤˆŒŢ­`é0ăĘňq*¤”.ňŐŁ ŘŕWlđđŒ=gŕƒRţl ´ ŐŃÝąŹŠjxéVă[3`Y!ďç!˛ĚŹ;׹¤Ý§aNşÜü-avÝšŽĺ„T+—RSU=ĂÚéŽčްœä Č̇‡Á<UUľXJHYĽTUsšŤŞŞĹRBî3ĽĐ1BžY™ËšPIiRžŮ|;~,#äÝí2QĄK$ ŐÍýc !'‹áŰ}2‰-y°ü5+–’”&“†ÇBĎVşŁy0L/äD1,Ů/mĆĚ>şŁypL/$)ŽVÉ `GÓwÜ…Š…œ(‚Ľ¤ü^źîhÜƒŠ…|’.Ů1Ş=8ҍ{0­ł—ŹŐvÔbZ!Ëţ’ěHŒŐ;őÓݘRˆR° [ W*dSáĺ‰ÖîVw-ňÓ?Đs‘ČčßRÇB‹şß cŕU! ˜ť †ÖdF|4Źő|źšşŻ˝ç.Ä ˛u7ȜŞäÁţ6ăV<ţvT+X‘)›‡\IýĽ×ĎíxTHÚIYŒš=WŽ;GÂâĄÖXXă)Ü.¤˘ Ö’ŢÚ_ŽIť"Sw&v—\?uă6!G aíAX¸r‹ä\h=x˝L‰ƒđ†ş/Őܗ+˛őŃţłR-íȅźi/bšÁŒ>ňł>VœîéIlJ)ő{žLBť•3ĽPzMʇ ¤:Ę:=j „¸(č%ËËâŃ}YćĹŚ”Ră7Ŕ×{îţŕ0ťTC­ËĎűŘ/#řÂA:„UZvj§'p8ÄÄÄ8ýŸM)ĽňJä+Š3ËôMń‰@ŁěQ´÷öúš˙çÝ`übE¨ť§˛Yů%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:46+02:00S5§OIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/cubic-out.png000066400000000000000000000033151216507631600207570ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹öIDATxÚíypMW€żźěDPKFIԒŇVD•"­˝QTe4Cg(ƒÖh+ÓNvT7ÖL×´DŹmQkŒĽ-ËP;IPIł ‘äößŤH˛˝ÜóîÍůf2÷ܗ7ÉďœďwŢ9÷wĎó0 Ă@ă68T )‰—ęŹFaÜ)‚ŤšpăVńăpňzĹ˙΋ÁŰłôăw…$&&RXX¨şžĘÉ·c×ä'ż~(8ź)x¨=§oČďłňJЍ*s ABv] E=ˆîĎľƒŽÍÍ}ĺW[ I͆öÂ÷‡áoçŔۨ {˘Ă`P8Twr°…}—`ÁnŘ|ňrŸÖ0ó)*oOVÁŇcHŇ%ˆý śü%ç>đ|{˜ŃşľP]Ő°dÉʃذ8I&duźaj„ôˆ ŐŃUK )2d žąE>=yx@L8̏„ şŞŁs –rô*źœŽČůcA°hôkŁ:2×b !q‡aęFYÖhäóú@L7đłDô•Ă­Ť”›óśĂGűä|p(|3šY|œxn+äŔżN8WPg÷‚÷ú§›Ď#Ş‹[ ůá(LH€źhUž CBUGen'äÓý0m“|œjËFB?ŐQ™‡[ ™ő ,rÎ-Ś÷€…ý­5Ëvn!$ó6Œű 6œ’ľŚš˝áÝgUGĽĺBŽß„qđgř{ĂŇĄ0Ž‹ę¨ÔĄTČ˝2šÖ…„ąĐŁĽę&Q‹˛Ĺśw ××"#(śŽ—+tľ%i@ů…0zUqĎĐ2Š1]Čí/¸ż7ʊÖ2îĹT!đŇÚb cäB’ŚÓu™đ­L_/X7V 4%1­‡źľ]fářd°–q?Lů”őă1ˆ^-ĺ/˘`r¸ęjť/5ŢCÎeÂ+ë%jj„–Q5*$'ĆŹ–”œž­`Ń@ŐŐujLˆaŔ” °˙˛¤h.Yű ŤB Yr⎀—VŒ*”Ź)›˛ó<źśEĘ‚!ŞŤi\.ä\&Œˆ‡‚"&šŚâ¸\HĚzȸ%™ƒ_ s˙\ZwĂĽB6’´Îˆ%GMĺp™ËY0a”_ímŞŽš5q‰À)!=GîťxťŻęjY—Y– ëN‚ż|7ž…fQm!ŠŮ0}ł”ßě 6U]%kSm!1ä6áîÁ0Ť§ęęXŸj ‰;"oUžžđíp™•kŞG•›05Ś9ߪćGBG}Ö%TYČű{dŘ=XĄ5ŽĄJBN݀Ľ‡dţŮ=w%•b01AňŞ˘ÚAD°ę*؋J Yž,7ăú’(ŐáۏJ šyfţ,ĺů‘Đ*PuřöŁRBďƒô\č$ëU×Sa!ç2aá)ÇF‚ˇžsÔnÖ9żBv h Ă;¨ŰžTHČi’qčçQż…‘ŠŘrœřtlŹ:d{SސßS!ń¤ôŽ7žVŽý)WČ;;e‘I]eÇ5MÍň@!ťÎC ÉV]ŻW™Â…ĚÝ&ˇĄëŢa÷˛2v_€†ţúš™”)¤°HĆ€9˝DŠĆʲú¸ěOŐ2Ś=Š:ÄÚE)!†!ű‚ôAb.Ľ„ħŔńëŇ;&uU^íŁ”ťĺ8[÷%”˛í,I—Ţ1Y÷%”˛ô'‡ËdPc>w…œÉ€5ÎYyŒž1Sw…,J’=H^čMl˛Žq\˕­X˝0ݎęj7€Ďʞ¸Ď<,_h˘Q‡8ˇíúű$ąvmşę˜lOçΝ )űNXĂ0ŒKY’ÁŢ%Hu¨K]…ŃÉ vpAgdK•:f‹‰IDATxÚíœ[lSeŔeݕ]Ę.¸ŃË€Œ& S0*BPAc0Q߈—Db@ÃFƒÄMŒĆÄE&0*(˘˘ Dĺ6ťŁƒ16śľŰ Ł]Wţ;ŮĆşöœ6çPŘ÷KšŻéůŸsÚóë9ßýłƒÁ Џa̝ţŠĄ(!SŐ[ŤŔ˝ÝŽ˝Ůľk@@ďqQňŃĹšétŇń8†oˇŠ<ÄZ&~í7áúZHąߎYŇÜ W:áţüĐ2@ ą”Ą/Αc” Šn•T ‰Îô )/9F ąęHśĂ”q#Ç(!ŃÓ Ü03ĆŘFŽSB,˘Á ^Ÿ ‡bZ†^Ś„Ä.¤JHœpÍ+éÄŹđqJˆEœť.éŒÜđqJˆE¸<“ ‰ޏbÍÝŕ̄%$>hę‚ ‘ă” ¨k“´4;rŹbŽNIóÓ#Ç*! ŐA"yA ąMH‘4¸%ž9V ą€Ú6HO’zH$” py  "Ç*!&sĂm7ôe蠄˜NŤnö*!qĂEˇ¤Ótd蠄˜N]ť¤%}ńJˆÉЃ€b:Fj頄˜ŽË6eę‹WBLŚÁ­Ż†ŽĄ„˜Č­^šCŠu>Ž@ 1•˝2¸ZoţJˆŠhý JHœ`´„JˆŠhÍîzk頄˜Jm_ząC˙>Jˆ‰¸<‘Ů)ú÷QBLÄĺńceNˆ^”“đdpœ‘ ”ÓpyDĘô\cű)!&Qßßěn¤–ƒVrÍxýpúšźOK”YN‘ĆŕFB똚Şc´â`Fľž^xo|~LŚ›iĚ)€í+aň¸č­Ý!*щ×K*áăCpÓOM…wź4řď*,­„Žžč_× 6˜dPę¨Ňíƒe[ŕďČL†/ÂîU°a_-}5mđöoџŁŃY)"ŘŁNˆ×ËÉřu,+Řî̀ĎËűoNÂáFăçđ÷Ił‰ŃÇŒ2!^,ýö7ˆŒ=Ť`~Ńđ¸yNxmŽ4Ż˙ËřyšşŔÝyúZ(â"Sďé•LđL+\í’Ôĺ“›&3XËóĽäijŘít÷ß. ܍˙ţcPyZî¤›ŕ úĎĽečFKXĐ/äðŁ:ö ›ž…ƒúŽ 3ĺłŰip‹„ł­ňŹî J%jÁ>ô[ą'ˤ&¢I°˛ fŮkÁ#ě÷ş™˜ĂęƒEœşcüÝl˜SOZœh ˙{–ŽĎe‹Ťű˝Ź/ŤÓ}ö5NĆ3Ö{‰':†mw:ä兞mHľƒĂ@X(=ŇTP߁>h HľKŚ75[ţőéI0É!u€˛ń`ëőAwłgqŞ%Ş8Ń ťëáçZyá+ŕĄě6^˜ OL‘z„†×_ƒŻj˛š5F&ĚlZĽ)]żi͂Dś]†ęRX;ŰAŢX}×ârM2łŠŇpd _.99yÄ}MYQŽ/ˇÂÇ$% ˝xFđúáÇsňHŮ{^2QGŃŁĹ2(íjtAK˙üđ 'T>~á—PŹŘߟ…‹aÝ}ű,Ţ^ďzăżńŽ_âĎÝ#rśWĂŃ+p}Н™‘,•źˇ*ŕŮŃ˙÷óđäf(́Ú7ôíSň)ô q 2B\dęąŕHWĘĺp­´XnŘc,G.ž,wU]œl†Ůůáăý}pÉ-ű•÷`ą÷žtÉ+ňÓc—˛”ŇËĺňţ§šČńŐ-’FS‚{Pˆ,™*éžúČąąyA ŃѲ ĂŃ&y…Cíi]Ź‘PBt`łÁňiRœ˙údřXm],u‡˜ŒVhŘQ=Phő+RqŐłŒF(”T8Ľ¤ŞEJ[Ąč葎ŠÉ㢯c)!XQ&iĺéĐŰ7Ę"ű ‹Ł?‡b€WË%Ý|j u`0GŻH:ĎŠűĂPB 0#W.vs7ě Q'Ń>›_ý9”ƒhwɗdž~~ľ Ž7KocŠąźˇŁ„äĽY2 Ľ™ŕ%ÄzŢŹË­UđKl?#Bg&,,‰íŘw}óűbÝ2„hl’ ÷éźŸ-…×çĆv\%$JnřáńoáP˙¨”…%2h"%Ć %$Ü=CgIE[;Œg¨L=ÎřÖdęgÁ G7%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:46+02:00S5§OIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/elastic-inout.png000066400000000000000000000035031216507631600216440ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹lIDATxÚí{L•eÇ?W‚P冂˜6ËFşŠššNçœmľ.ö‡ćŽś.ë˛\ËőG͕Î\+kEmŽ9m•iĺĽ/ T@šz¸#Nü<ž ěŕ{žG>űž÷œ—ßű~Ďűű=Ďű>Ď“Ýnˇ3†×ŕc´côÇl´žŚý:,—oړ)`2íŃČ0é˛ď†CĺőGŮđň|Ł=Z…ʆ8r ü}ĺ÷wŽ@s§Ń^ ­9P6;<=Ê{ Œöjdh%Č•bł`óy˝3TŠÉZ%ő“WŔě‹§CẊÂ:8[ éSŒönxhs…töBqLˇ€%PzW+Se[ŽBaKAÎ7BG̛ćl{&]ěž §Ďh‡‡6!+˙ŠŘĚ(g[J$̛ UĂOĺ°$ŃýgŰ{ࡠ¸Ú&!/c ̜dĚqh#Hi“ŘŒšbmšňĹ÷‚l? ŻÜ=NŸ"!oĹ˝"ʃ–nhꄺvą‰ ‘üő_Ɓ›Aë́a^^6›ÍčózŰ|pi>'ŹQěJÎ#"ĐyÍ]đ|ÉrüĚ>ěLŢOˆš€>;ěśfąŻÂ@b@‰ǰš,T†=LUŤDs“ bBaBXť Şz=ţš_•\7mFęłśCu+Ômß™qu.|{^[[IŰ[‡áÝ#˘ś> 烯Ë7öÄeŘW^ÜmN‰„ä0K'ä=% Ă÷÷Ľű!Ŕwpť6‚oÔ‰pň…ÁŰ~,ƒě _=§káĂc˛mÇ2x1Óhďh‘CŞ[¤Ű›0ÁýöÇŕŮ řü4ŹýÁŮţŢ"ď4đĐo%ŔśÇ!j<ä×@x ŹIƒ'’Œö|0ZR6 A‚ýäŠđv´VľˆJUĐBJŤŘ1Aź„â €Č`Ł=ů˙h!HĽŚ†Č˜Bu”?„śër #&ĚhO<ƒň‚ÔľCW/Ćí‰gP^:h HńűG3öÄ3(/ˆc ;–CźGČÄK(k’întˆŃžxĽąŰĄĘŞOBĹéśÉC)×GŹŞŁ´ ŽťźşäP\S5bc4‚ₜŤkԔŃ@iAN߸BT™&:Ô¤&“]PVÚ6šË;7Úý„3UQVâ™ě–:ŃhO<‹˛‚ÜLčc‚xŽ1HŞF=,P\_“s*§.(+HQ=X‚ô˜ŘŕŠ’‚tôŔ•Výň(*ˆă9şNwy()ˆnĽ\QRG+9ÂhO<’‚”jxŰ݁’‚\l;–Cź„Ęń‡đ Ł=ń^_ŮşąC*ţ$NĽîx˝ w^˛îFţRۃ"%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:46+02:00S5§OIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/elastic-out.png000066400000000000000000000035261216507631600213220ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹IDATxÚí[lTEÇť˝mď-˝ĽŮBiĄxÁ*‚HźP”¤€‰1ę„1ŃŁ Ć}1Ć'ĆDcŃHŒ­T# ˘HĺhKoôb –śŰťíś]ŚŰvťˇłŰŇén痜̞˞3ßůď÷Í̙9ł:›ÍfC1eĐË΀‘PžtŹ Ú-ë‚NśA„Ď‚|~Ţ9>˛žďؕ/یŕÁ§ŐҝŸŸĘéť%PŮ*یŕÁ'Aö‡Ž>X3ţ|ÖeŮ mFđ YA|M”ŽŰžX!PXő˛M 4 RÝ•m“OÎŰ2`K žs˛M 4 ňs™H7d;nߝ/źćĐ5čmNŕŁY“ľ"+ȲŮbiî‚_*d›řhäB$ śóžŠô‡ë˛Í |4 RvZͰ|„şřĆĆˆ …˘rh7Ë6)°Ń$șz‘ŽČp˝?Á/fC˙ üT&ۤŔF“ 7ZDšŸîţ˜my"=tMśI&AŞÚ@݃ełÜóœQxĘßőPg’mVŕ˘ŮC ĺţ˜ČPxe‰h“üZ)ŰŹŔĹŤ ÷ŹĐÔ‹SźŸěĺ\‘ŠęŻßx¤ąĚý5ĂűÉVf@\„¨tőÉ6-0ń*HU›H&y?YD(Ź5BO@áŢj†ŕÔ-ą”ľ€5ȟxíą×°´°9ŽÜ€//ŔŽeţeް>> —ďˆ2i41áđě|_Z(<2˜đ*ˆÝC´„,€‚˜ —nĂŮFxbŽöĚXúa{1ź"ÖSŁaËČMŰÝpń6œ¨ Тrᑛs„8ë˛Äş/˜,ĐÝ'²'Ң!1rd=Á0ŢŰî}CII Îń`oÍjJ[")Î˙ZöW¤sԔdžy]ěL;ŁíK†öV.§´ čcńVž•č0ÇĂzŹP| k˘1%=!áÄŕ™y°8U˜Ř[V3D΀čT;áz‹đřž(ż+Dö‡´˜ńw[WěvíÝÂX,§6÷GŞŁl‡ĹëEě4uëÉ>6çßěeQ˛çăŰ-đüᎴ„‘‡7ÚX•Ţëő:ý­Ôqäœm€Ž^đ6„&DŠ1âWŸ-jńČJÄĺîfëČ9;,Đ질cůjD…9o×yÔf†¤Oaý(ŢęŰß(‚o.ĂŤKá`g1Ö„óM˘S˛ šéŸ‘ pŠjÚˇëu˘ Œ ‡ědĎí)ŮxŒşž–Łů`|wUÔśŢ[ KR1#)Nlƒý #N,ŒÇRÁ.HކFáX̀­KE×ďŽßD=šv3Źĺ'_ŸÁ‚GA*Çá!Ÿ<-ŞŠ§ëŕíc#=Š›aĹ×P:*L)1CVíP,öWô8řś6ýJáLƒ(H˙¨ž“Ĺ[ü/3‚Ż!+* RĆQ,‚ď7‰›őœ¨Č0Řó\ŘŽÄ‹ÇZÖĚĎ 6*÷Œ˙Býƒ˘`‹ÂˇˇĽťOT{žĺËé<\H[¸Á‚ېU×ÖA˜— ;‹Ó ˇ‚ŘG"j}¨¨˜Ü RqW¤ţÖ°ţá1d̍—Ĺé…ǐ˘ƒôXŮYœ^¸¤ĄC´AŚňƒ¸`Ä˝‡t‚Q•“ŽKAL¸Ó ĆDŮٛ~¸ÄŢ Ł ôÉÇĽ ö6HZŒěěM?< ’Š ŽVL<΂ Ő°TŁPN‚ÔŤÇîRq¤A "ˇ˘ZérpY†ÄÔs,Y¸Źe͍SÓöÉÂAŽ^ąd¨p% AÚĚb@´*Đĺá ˆ}U ËĂA›C“Y> şnĽá ˆý%HőŘ].QU^y8Rké|˛¤á HU›ŞaÉfXs˙PŁP "•aAŽ˙'^÷ç[ĹÄ1,ˆ}’%ˆ\œŃ2Q™âţ1˛”‡L †9÷/$EŠ6ˆlôˇLâżA™)^ŇQČCb=žçĺULzłżçyy“C(ˆIô:č)?NaĹ=Ůy zňňň0.÷él6›­ąStN-M“U…NýąäÔB §žbüÁ^Ű%PűŘy%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:46+02:00S5§OIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/expo-in.png000066400000000000000000000031421216507631600204420ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹‹IDATxÚí}LUeŔ¸(—Šˆ€˘@*¨$‚bš’ÍZ–ÎrşĚŇ>ŹÍ>śśV-ŰęÚ\ľľÖ÷šśľÖ֚–l9ľÍ‰ócÂěC™~€ˆ(ȧJ|\N<8@š—sď=ç\…ç÷Ď{vĎóž÷îţ8ď{ĎyŸ÷Ĺe†rŰî ôE…8Ěń˰í8txű?uă °°Ż×kś]%H>ŤœËţ† 4ź q‘ˇžwéâ,_AÍU¨{ †GÝz^ť,š| Î6@fB˙2@…8JÉEč2`aŞďâ ĹŐRÎď;F…8ȑ*)s“}Ǩ‡čč‚ĂUŕť|ÇŠ‡8×WZ!wD¸|ÇŠ‡8P)ĺÂ4˙q*Ä!n č÷ĽúS!qŹFĘÜqţăTˆC”^†Œxăń§B ´šÚ`FŇŔą*ÄŠşôş+P!Ž°ç´”‹ď8V…ŘL—‡Ş & î0pź ą™ż.Au 䥂Ç=pź ą™ÝÝÝŐ“ĚĹŤ›ŮU.ĺƒ*$ü´´ĂŃ ň@qž‰ńTˆ­UŔľX2\.suTˆÜčŽÉ0_G…ŘČÎSre<œnžŽ ą‰ż/ÉČĚą0a¤ůz*Ä& ĘŔVL Źž ą‰‚2)WgVO…ŘŔ™(žăGŔL{ŁBl ż ÖL÷?Ţ*ÄňOHš&+đş*ÄbjŻI†bĘH˜Ÿx}b1ŰOJšb*DŘ] ąœÝBVN Žž ąŠFŘ{bݰ(-¸6Tˆ…|˙§¤Œ>‘ąŃÁľĄB,˘ł ž;&Ç/Ď žb;OAU3d'™›;÷… ąˆ-%RžÂŐ*ÄĘę$Ő'6Ög‡Ö– ą€Íű%ÝçŮˆZ[*$DNÖÁĎ' *ŢČ ˝="É/ʧs$™:TTHü{~úÜđÎ"kÚT!!đMąŒër`ŠW¨ šŘߖČ|Çëó­kW…ÉÇáz,Ÿ"‰ VĄB‚ ´śËń{÷[Űś Ž.ŘX­°*Ó˙Ž Á BäóĂpđ<ÄÇŔËŹo_…@q5źżOŽ?Y Š$Ŕ™E…˜¤Š žüEňU™°a–=ďŁBLňb!œn€‰qđíŁÄtš)Tˆ Ę$ľÇŰ—ővĄBŕh5<ˇCňtß]l~áM°čž‹~¨l‚Ü­Pß*‹6÷>cnáf(čâƒĘ&XňƒČ¸'v­ˇ_ôÚ&Véáp<śM˛'†_×ÂČaÎźˇ š‰í'ĺçmťrĆBáS6Ęš÷×.Ť[K`mžČX™ EĎ;+ô  ö:źöťlnkłŕÇŐ2-ë4CZHťž<€†V°y lZřşŤ˛BöƒM{ä> /ž^ł“Cj6d†œÝ§áŁ"`L÷SŰu3Ě/!!¤ćޤę|zHî/F ‡Wç›y0:&ܟ°‡A+¤´VöÉ/…?Νňú´Ř86Ěx˙Ăp0(´{Ąź^öŚ*(“ťs=çGDò)đÂ,x(=|śî(!í^érNÔĘpŹFvű,݇ś^˙‹Ćă–,ôĽé˛qń‚4YDs'v!mpśŽśK:?ČlÍmPŃ$]My˝HčđJ\o vpAgdK•:f‹žIDATxÚí[lTE‡żíJ Z[(…h›Ę-\äP Š„ F‘`"ńÁ$h ‘ř€čƒžXƒ‰Ćƒ „T$) `ĺnÄ.)ÚBmŇ ˝mˇăĂ„évťsfś_ŇĚtĎćôˇűuĎ윙3ÇĽ”Rôŕ"tčáżDé`ŢđtHýr#Ôľř^m üÝxďý<“ёw?ţݐ‚‚ź^Żî׍†6p×ČO[ż HÎĄ]š8{Mś×ˇÂľćŽ˙ÚUčGˆŤ§ }çaŤv•By´ŢńůPĐŇ !\Ŕč$ŮÖ+ †őóżßŒčۤÁé§ÁŰCÖĺř°ž>UžCK¤ rS`rŒK…œdČN†¤¸Đĺ ;!5MđţČ?ÍylęXœ ‹˛ =Qož°ňĂxĽ@>.ĚτľłĺđáÂBˆ6ţo˙ ĆŚ@ţ˜’Ś;Ů݄…÷öĂÚ}R_6>ɓĆ؉X˙-ks1<˙Ô?˜ o=Ş;Ńýąş§~ě,ÝJÁŠÉΗ im‡çśB“žĚ„ su'z0ʞąJkax"|ůÄDvuĄÁJ!çjaýĎR˙h^h;v]ĹJ!k ĄĽň2ŕé1şÓt넸k`K1DGŔÇyşÓtë„l8^/ƒŒşÓtŤ„4´ÁöiŔWĎН&0ʞă \o™Ă`DÝiĂ*!›NJšlźî$cň:8p{ÁüQşÓŽ5B6C›ކ„ÝiÇ![ÜR.5řp–špŽTÂŕ˜ţ°î4]Ă !ŰK¤\”%ăâ&c…=eR.Î֝¤ë/¤Ľ Ë >ƙC˛Ĺx!‡+Ąą Kwî°lg0^Č^ßáęńtÝI‚ƒńBv—J™—Ą;Ip0ZČ œŹ‚ÔxČŘőý9Ł…ż$ú#t' F 9R)ĺÔ!ş“Ł…ö ™ixďüvŒRT.'G[Ň~€ÁBŞĺ ŚGR ւţÇMŒň[•Lœž6Tw’ŕbʐâ)Çҝ$¸˜+¤ZĘědÝI‚‹ąBÜ5rkځS}Bš=pŞZ.?‹‹Ö&¸)äPšĚjŸ`Yű† 9xQĘYĂt' >F )´ě”űí'¤š]N™¤Ć›9w÷˙0NČĄ‹2˙jÎpY)Á6Œ˛Ë7 ecű& 9+ýĎłd„đNŒrú üQ #ő/Ń]%äŰbY•Á†ůW÷Â! ž9%ő%9şÓtĆ9Z %WĺBœ‰öĐobŒĎ}ăź;+vĘđěä48¸T! 7´Ď?Z ëöÏÉďĎćŔ ĂShrć*źS[OË'$.ޝŤfČí • )ťߟ–{uüZ!ĹDÂk“`ĺ4YŤ$Üé!žpWË%7ďVs˛JÖ´ňúZŹÔxŠ}}ŒIŇý68—RJU@ɕť7^ju ýŃĐ • ˇžWß*ősľŇ0ßIßXšIʄA˛ŚŐěáş_ş3q)ĽÔňđéąŔv0´ŻÜş'.öUôď)ń@]9Ô¸IofH_;'śBnn.#GŽôťÍĽ”Rő2äŰßhÄF…w#lŃéáaúmßšü„expÓÜۍ%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:46+02:00S5§OIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/expo-out.png000066400000000000000000000031301216507631600206400ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹IDATxÚí}LÔeŔ?w"‚ź#ŚˆCĄ|/Ēľ '˝NmŤŐšŤ­lÖŚ˝üŃFľúŁś\ľZ›ţakm8˛0f™lMĽEކo€ČÔB‡źČႸűőÇWąÇŰqwĎÝýžĎĆžÇqwű>żĎóű=Ďó{žł†a  ŹŞиcS@02ä—‡văÚ ŘűźűĚś>čźőűĆ<ˆŒýş!UUU8NŐÇbÚ ť kŽÉA¸ę€ŽţŒ_‘ѐ˜V)zß´őş†˝ý|(zހB,ĄzéqŔ‰vh섆N‰CN‰˝ƒż?y–üÜ$'l˙kŔ㣠#Îó{s“ŔâEÎą3`Ţlyźj.Dx8a„„î¨j rĐí×Ý_3#2gCZ ¤ĆŔ˛t˜iƒ…‰Ň4ä&ÉëâgBFŹęMP é˙‡_[ úœíroÓ3ă /ňSĺŔ/Iœ$ůŻu‚ć¤î2äŕs*›¤mˆ°@ö(Ɂâ,¸˙vHˆ‹7mF ź†tŔŢS°ťÎuÉs6+”dĂćĹPšëŢև;ĘjˆcvŐ‡żÁľäšůń°˝6-–fɌ\ˆaŔĎ`g5ÔwČsĹYđÖZx([őáPO@…ŘŻĂËĺrYůézŠ!`BŞšaK%t; Ú;‹ŕľB˜WFž$ Bž:ϧŤ2aĎ#pgšę˘'~ňŢ1(;"—ľ/,—&*:Ruąƒż vÁ3ßÁžfxe5|˛>|űžÂ/B†]đě÷"#Ň Ÿm€W¨.jhŕ!eG ź^ƗĘ7ÂyŞ‹:ř|‚ęƒxżFšŠ/JľŒŠâÓĄ“ú¸ëK9ô ěXŁşxĄ‡ĎjH˙ vpAgdK•:f‹hIDATxÚí}p gÇ?'â]˝V´Ş^*­ž â5ŃR 0ŻŐiË(Ş45Şhuú:Ć0ăĽR/†!äE˝śB_¤š ŁŐ´Ž†’—JʉÜÝöEšp—ěÝîííçŻ<“Ëîłű™ě>żď>ϞEQÝPMë˜Ü)ÄËüp6‡RGůżźőĂöíŰq8Žn×ÄMJě°â\ž-n‡ĆCƒ€˙ÎbŢC<υ`T|÷X,03>zĘš>şżywH́ ŠPhƒ:A°)˘ŰVüySˆ‡°ŮaŢ~Xô#8čëb }ă{˙)Äż#“ŕ×Ë`ŚtOűA° gۢ2i90.ţž!uaĺ{_˘Ęb Q ›f쁕‡A" y$4ŤíŢvL!*p2Ć&Cćy¨fˇnŽ˘+Qĺ™BŞHĘo06ŠK aMX?šq‰*‹)¤’ÜpŔ”pzľ‚Ă!¤^Őśk Šç‹!n dXĽĐ‹ď "Ą† gÓâ&ëŽÁ›ťĄđ:4 †510äQőśo q‘Ť7`úHȒvˇPX튝Sˆ ż$YÔ/—eä4ŻĚîő÷e šŰNŔËŠpĽBëÁŞ!0ŕĎíĎR6˜šÖ•BŻw+HMÜ,ôÜĹRÇ/AĚ&8](ٍY°°/T}Ű÷ĂR†Ľ‡ ţk‰BZ7¸źkˆ÷öo š‰Í.…Ţę#ŇÚž ÍęxˇŚîŽËƒ¤Č‹ď!—+oă×Bœ Ź9*7ď[qůę íúäˇBlvŠ-Ňr¤ŮZîîĆĺjă—BNäÁ„‰ËkÉ%jZ×ĘĹĺjăwB–dÂě}p­Tâňm#ĺżC/řLß ‰ŮҎn +W=.Wż’a…Ř-pĄŞŔQđv™€ 7 /dÝ1˜ş ŠJ SSɢş…jÝŤŠ1ʐźk0>vœ’v߇ m”ÜÄőŒ!…´ŠŒÜ™ ľ fDx&.WC Q€9űŕ“ƒRôľn Sq:7׺gŽc!wŽ˘ŞY`â“đyhPS랚‡!„|sF"Y‹$Z Ż>­uŻ*‡O ą;áł x7].QˤoĆĺjăłBÎ][ŕĐyiyV †ZŐľîYŐđI!V“ g á`X<F‡k—ŤO q*ňDoÖ^(uÂĂ a˙8hY_랊‡ĎąÁkŰaWŽ´Gu‚eŃ Ÿ’ýôK„KWĽŇ^ÓťiÝ+Ď k!ĽNXüĚ? qyçć°ńĹű/ óet+¤Ŕ&ٍôłŇŽn+S7×ŇşgžE—BŇrŕő—ׂĽa|g}ĆĺjŁ;!~/…H\ž~<áCYTUэkLúęv\>ł;źĺÚĘU#Ą‹Ăݓ Ł“ĺFp |üLíŞuŻ´AS!×í0']FRNži!‹ë;6Ńú´h‡fBňŽImqôâí¸|ů`¨ŽƒŠ8Z˘‰;ăňŚľe8;Ѓk.| Ż )/.OŠóďKTYź&ät!ź´ŐxqšÚxEHúYˆÝ,+W—ŤG…ÜpŔ{7_QTꄈP™Đl¤¸\m<&ÄZ$ď˙8đť´_y =uu>/JkT˘˛e5ҕɢ‡Á°öZŞo ŞR§,~Y’)ía0ÔŘqšÚ¨&$ˇ@^ܕa•Tv^$Ěí-EŸ‰ë¨"$-G&•Č(jy4Ä=ŚőĄů&UrőLÚq{ÍEˇPŘ<Âtść—¨´Ó…0pœĘ—Ľ`łşĂÜ>ţ—ŤMĽN_bśĚŁ-°IMą~8ôjŠőĄˇ„\ˇË◄,Ţöl)2Z™…žj¸,$óźz'óeä´ ŢéiĆĺj㒐„,˜źC挰zň.Z3.÷ ÷bw´ݰěgiÇv”BŻ~ ­ťm\*râ2ŒO˝—Ďí ó#ÍBĎӔ+dUźąJRč}9bĚ,Ę+Ü%¤¸&ď„ő7 ˝Am!a vpAgdK•:f‹hIDATxÚí}p gÇ?'â]˝V´Ş^*­ž â5ŃR 0ŻŐiË(Ş45Şhuú:Ć0ăĽR/†!äE˝śB_¤š ŁŐ´Ž†’—JʉÜÝöEšp—ěÝîííçŻ<“Ëîłű™ě>żď>ϞEQÝPMë˜Ü)ÄËüp6‡RGůżźőĂöíŰq8Žn×ÄMJě°â\ž-n‡ĆCƒ€˙ÎbŢC<υ`T|÷X,03>zĘš>şżywH́ ŠPhƒ:A°)˘ŰVüySˆ‡°ŮaŢ~Xô#8čëb }ă{˙)Äż#“ŕ×Ë`ŚtOűA° gۢ2i90.ţž!uaĺ{_˘Ęb Q ›f쁕‡A" y$4ŤíŢvL!*p2Ć&Cćy¨fˇnŽ˘+Qĺ™BŞHĘo06ŠK aMX?šq‰*‹)¤’ÜpŔ”pzľ‚Ă!¤^Őśk Šç‹!n dXĽĐ‹ď "Ą† gÓâ&ëŽÁ›ťĄđ:4 †510äQőśo q‘Ť7`úHȒvˇPX튝Sˆ ż$YÔ/—eä4ŻĚîő÷e šŰNŔËŠpĽBëÁŞ!0ŕĎíĎR6˜šÖ•BŻw+HMÜ,ôÜĹRÇ/AĚ&8](ٍY°°/T}Ű÷ĂR†Ľ‡ ţk‰BZ7¸źkˆ÷öo š‰Í.…Ţę#ŇÚž ÍęxˇŚîŽËƒ¤Č‹ď!—+oă×Bœ Ź9*7ď[qůę íúäˇBlvŠ-Ňr¤ŮZîîĆĺjă—BNäÁ„‰ËkÉ%jZ×ĘĹĺjăwB–dÂě}p­Tâňm#ĺżC/řLß ‰ŮҎn +W=.Wż’a…Ř-pĄŞŔQđv™€ 7 /dÝ1˜ş ŠJ SSɢş…jÝŤŠ1ʐźk0>vœ’v߇ m”ÜÄőŒ!…´ŠŒÜ™ ľ fDx&.WC Q€9űŕ“ƒRôľn Sq:7׺gŽc!wŽ˘ŞY`â“đyhPS랚‡!„|sF"Y‹$Z Ż>­uŻ*‡O ą;áł x7].QˤoĆĺjăłBÎ][ŕĐyiyV †ZŐľîYŐđI!V“ g á`X<F‡k—ŤO q*ňDoÖ^(uÂĂ a˙8hY_랊‡ĎąÁkŰaWŽ´Gu‚eŃ Ÿ’ýôK„KWĽŇ^ÓťiÝ+Ď k!ĽNXüĚ? qyçć°ńĹű/ óet+¤Ŕ&ٍôłŇŽn+S7×ŇşgžE—BŇrŕő—ׂĽa|g}ĆĺjŁ;!~/…H\ž~<áCYTUэkLúęv\>ł;źĺÚĘU#Ą‹Ăݓ Ł“ĺFp |üLíŞuŻ´AS!×í0']FRNži!‹ë;6Ńú´h‡fBňŽImqôâí¸|ů`¨ŽƒŠ8Z˘‰;ăňŚľe8;Ѓk.| Ż )/.OŠóďKTYź&ät!ź´ŐxqšÚxEHúYˆÝ,+W—ŤG…ÜpŔ{7_QTꄈP™Đl¤¸\m<&ÄZ$ď˙8đť´_y =uu>/JkT˘˛e5ҕɢ‡Á°öZŞo ŞR§,~Y’)ía0ÔŘqšÚ¨&$ˇ@^ܕa•Tv^$Ěí-EŸ‰ë¨"$-G&•Č(jy4Ä=ŚőĄů&UrőLÚq{ÍEˇPŘ<Âtść—¨´Ó…0pœĘ—Ľ`łşĂÜ>ţ—ŤMĽN_bśĚŁ-°IMą~8ôjŠőĄˇ„\ˇË◄,Ţöl)2Z™…žj¸,$óźz'óeä´ ŢéiĆĺj㒐„,˜źC挰zň.Z3.÷ ÷bw´ݰěgiÇv”BŻ~ ­ťm\*râ2ŒO˝—Ďí ó#ÍBĎӔ+dUźąJRč}9bĚ,Ę+Ü%¤¸&ď„ő7 ˝Am!a vpAgdK•:f‹hIDATxÚí}p gÇ?'â]˝V´Ş^*­ž â5ŃR 0ŻŐiË(Ş45Şhuú:Ć0ăĽR/†!äE˝śB_¤š ŁŐ´Ž†’—JʉÜÝöEšp—ěÝîííçŻ<“Ëîłű™ě>żď>ϞEQÝPMë˜Ü)ÄËüp6‡RGůżźőĂöíŰq8Žn×ÄMJě°â\ž-n‡ĆCƒ€˙ÎbŢC<υ`T|÷X,03>zĘš>şżywH́ ŠPhƒ:A°)˘ŰVüySˆ‡°ŮaŢ~Xô#8čëb }ă{˙)Äż#“ŕ×Ë`ŚtOűA° gۢ2i90.ţž!uaĺ{_˘Ęb Q ›f쁕‡A" y$4ŤíŢvL!*p2Ć&Cćy¨fˇnŽ˘+Qĺ™BŞHĘo06ŠK aMX?šq‰*‹)¤’ÜpŔ”pzľ‚Ă!¤^Őśk Šç‹!n dXĽĐ‹ď "Ą† gÓâ&ëŽÁ›ťĄđ:4 †510äQőśo q‘Ť7`úHȒvˇPX튝Sˆ ż$YÔ/—eä4ŻĚîő÷e šŰNŔËŠpĽBëÁŞ!0ŕĎíĎR6˜šÖ•BŻw+HMÜ,ôÜĹRÇ/AĚ&8](ٍY°°/T}Ű÷ĂR†Ľ‡ ţk‰BZ7¸źkˆ÷öo š‰Í.…Ţę#ŇÚž ÍęxˇŚîŽËƒ¤Č‹ď!—+oă×Bœ Ź9*7ď[qůę íúäˇBlvŠ-Ňr¤ŮZîîĆĺjă—BNäÁ„‰ËkÉ%jZ×ĘĹĺjăwB–dÂě}p­Tâňm#ĺżC/řLß ‰ŮҎn +W=.Wż’a…Ř-pĄŞŔQđv™€ 7 /dÝ1˜ş ŠJ SSɢş…jÝŤŠ1ʐźk0>vœ’v߇ m”ÜÄőŒ!…´ŠŒÜ™ ľ fDx&.WC Q€9űŕ“ƒRôľn Sq:7׺gŽc!wŽ˘ŞY`â“đyhPS랚‡!„|sF"Y‹$Z Ż>­uŻ*‡O ą;áł x7].QˤoĆĺjăłBÎ][ŕĐyiyV †ZŐľîYŐđI!V“ g á`X<F‡k—ŤO q*ňDoÖ^(uÂĂ a˙8hY_랊‡ĎąÁkŰaWŽ´Gu‚eŃ Ÿ’ýôK„KWĽŇ^ÓťiÝ+Ď k!ĽNXüĚ? qyçć°ńĹű/ óet+¤Ŕ&ٍôłŇŽn+S7×ŇşgžE—BŇrŕő—ׂĽa|g}ĆĺjŁ;!~/…H\ž~<áCYTUэkLúęv\>ł;źĺÚĘU#Ą‹Ăݓ Ł“ĺFp |üLíŞuŻ´AS!×í0']FRNži!‹ë;6Ńú´h‡fBňŽImqôâí¸|ů`¨ŽƒŠ8Z˘‰;ăňŚľe8;Ѓk.| Ż )/.OŠóďKTYź&ät!ź´ŐxqšÚxEHúYˆÝ,+W—ŤG…ÜpŔ{7_QTꄈP™Đl¤¸\m<&ÄZ$ď˙8đť´_y =uu>/JkT˘˛e5ҕɢ‡Á°öZŞo ŞR§,~Y’)ía0ÔŘqšÚ¨&$ˇ@^ܕa•Tv^$Ěí-EŸ‰ë¨"$-G&•Č(jy4Ä=ŚőĄů&UrőLÚq{ÍEˇPŘ<Âtść—¨´Ó…0pœĘ—Ľ`łşĂÜ>ţ—ŤMĽN_bśĚŁ-°IMą~8ôjŠőĄˇ„\ˇË◄,Ţöl)2Z™…žj¸,$óźz'óeä´ ŢéiĆĺj㒐„,˜źC挰zň.Z3.÷ ÷bw´ݰěgiÇv”BŻ~ ­ťm\*râ2ŒO˝—Ďí ó#ÍBĎӔ+dUźąJRč}9bĚ,Ę+Ü%¤¸&ď„ő7 ˝Am!a vpAgdK•:f‹)IDATxÚíÝ!Â@Ń_h¸¨Áě]М Íz ‰GV!p͢¤ř¤óTł5?™¤+ŰŐZk„ąi=@ż ÓĆqĚ<Ď­÷ŹB)%Ă0ü}×y‡°řɂ1ŒA` cƒŔĆ 01ŒA` cƒŔĆ 01ŒA` cƒŔĆ 01ŒA` cƒŔĆ 01ŒA` cƒŔĆ 01ŒA` cƒŔĆ 01ŒA` cƒŔĆ 01ŒA` cƒŔĆ 0é“äúLSë)ër*Énť<ď“ärOΡÖ×ĺxř¤ŤľÖç+™Ţ­'ŽKŮ'ŰnyîOÁ`źÔa>ęe!Ἂv%tEXtdate:create2011-06-10T22:30:45+02:00€n%tEXtdate:modify2011-06-10T22:30:45+02:00bÝ˝ŇIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/none-inout.png000066400000000000000000000010001216507631600211450ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹)IDATxÚíÝ!Â@Ń_h¸¨Áě]М Íz ‰GV!p͢¤ř¤óTł5?™¤+ŰŐZk„ąi=@ż ÓĆqĚ<Ď­÷ŹB)%Ă0ü}×y‡°řɂ1ŒA` cƒŔĆ 01ŒA` cƒŔĆ 01ŒA` cƒŔĆ 01ŒA` cƒŔĆ 01ŒA` cƒŔĆ 01ŒA` cƒŔĆ 01ŒA` cƒŔĆ 01ŒA` cƒŔĆ 0é“äúLSë)ër*Énť<ď“ärOΡÖ×ĺxř¤ŤľÖç+™Ţ­'ŽKŮ'ŰnyîOÁ`źÔa>ęe!Ἂv%tEXtdate:create2011-06-10T22:30:45+02:00€n%tEXtdate:modify2011-06-10T22:30:45+02:00bÝ˝ŇIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/none-out.png000066400000000000000000000010001216507631600206160ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹)IDATxÚíÝ!Â@Ń_h¸¨Áě]М Íz ‰GV!p͢¤ř¤óTł5?™¤+ŰŐZk„ąi=@ż ÓĆqĚ<Ď­÷ŹB)%Ă0ü}×y‡°řɂ1ŒA` cƒŔĆ 01ŒA` cƒŔĆ 01ŒA` cƒŔĆ 01ŒA` cƒŔĆ 01ŒA` cƒŔĆ 01ŒA` cƒŔĆ 01ŒA` cƒŔĆ 01ŒA` cƒŔĆ 0é“äúLSë)ër*Énť<ď“ärOΡÖ×ĺxř¤ŤľÖç+™Ţ­'ŽKŮ'ŰnyîOÁ`źÔa>ęe!Ἂv%tEXtdate:create2011-06-10T22:30:45+02:00€n%tEXtdate:modify2011-06-10T22:30:45+02:00bÝ˝ŇIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/quad-in.png000066400000000000000000000035011216507631600204200ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹jIDATxÚíyPUU€ż.ŕŽ).Y䮙ŚNšLЈB‚˘4hš:ĺh3Nš™ÚL9Ó˘Łcă¤Ů¸MႠĄQ!¨YnĄâŽŠ(*Ę"ëăöÇGR„ˇßˇœďŻ{ďť÷źóřćÜß=÷üÎÁ iš†ÂiđŇťŠ˙Ł„8˜ă7aó)(3V˙šĎƒÄÄDŒFŁŠĺ*, Ť>Ę͝b/rçAcďÇĎ1¨â*4?]€>­áŘTđŽćţ¤nYbĹQ‘áď ë#Ş—JˆC¸[ KĘö˛aĐłĺ“ĎUBěŒÄî„[÷Ą_˜Úťćó•;óŐ!Ř}ęúŔŞP0j>_ ą#'2aQŞl/}úÖ~b'ŠĘ`Z"”al7˜ŃĎ´ë”;17YZH˰2Ôôë”;w Vý ŢXO50ýZ%ÄĆÜ̇{äéjÎíhŢőJˆ™•$ýŽ—ÚÂâ`óŻWBlȊٰă řzáŁŔǂżŽb#ö˙ď˙"Ű_ź=ZZVŽbŽŢƒ¨­`Ô ş;ź×ßň˛”+).‡˜ípťH^Ź Ż˝7^Jˆ•ĚOCץq]Ř őęXWžb›NÂň#ŕe€ďFĂłMŹ/S ąů0ť2ˆ/ cşÚŚ\%Ä K%ˆß.‚ţmŕ㥜+[ 1Ł“vÁ‘ hčq‘–ő7ž„b&KÂö3"awŒmâFU”3HşŸíŐa0¸˝íżC 1‘żł`|<”WŔ´>0ĽˇőeV‡bšĹąňJ`hX>Ü~߼„ÔBŠ&î„+w!¨ l‚úVvţjB Š…˜í’¤ŕë ?DĘ =QBjŕƒdy˘Şë;˘ĽĎao”'°ć8,= ŕëPićȟĽ(!Ő°öźłGňq?oŰ鉪:T˛ő#$_‚đ-’Ć3Ť?Ź!­ÄQ(!UHρWÖCÎ}ˆěۢŹ۰%¤’3ˇDFvĄĺÉĘѨdŔŘm"ă…V°'F Zمđęš]@ÚthíŻ_}<ş…d@pĽŒ6°o’ž2Ŕƒ…Ü-†pş˛e¤L‚NÍôŽU•IŸžDQ™ÄŒ2öO‚ŽN ú^ZB¤Áô-˛ýţ)zÁëJČÂ4˜˛IŞŹ„đšŽd€—•Ş xBř` ęˆnĹkJČçű`ň&پހëŻ~ßp †­€âRýÜMýŚňÇ9čťTzŕŁ"!)^uDˇÇÔUÖéˆ_!2bÂŕë8ŐÝÓ šZc’!3_&’֏{Ýż×ݘRH™/ţŠ'!(6Ž…†ŞŁŞŚ˛0 ž;$Y É#ĄcˆęˆŞé„ü|Bfúć‚mUGT3L%$ď*ŒN–ÎQ‘đrWŐŐÓрЛáÜUč ‰CTGT;L#ä‹}ŇnřÂgƒŐÎiÔSI?+IlłzCˇ0ŐŐĂ )(†ŃŤ °žj3zގ¨n^ČëŰŕh>„Á’XýŽQUC ŮpLFq}lđí0¸§ęˆęŽa…œ)„6€‰ŃĐŤ•ęˆ\ƒa…ź›*KĹş4ÓďÜFm0¤_rŕËýRU-Ž•Œtł`8!WJŕšľ2€8ŽtjŞ:"×b(!ZĹ(nfžŹŐűxęˆ\Ą„$ŚĂ÷Ł¸Ë†Cp=ŐšĂůý,LŹČ™ÝzśT‘{0„˘Rxv­$)<oź7~; !dÎNYł(@3Ł{!+ĂÜ]˛=9zăˇC×B2ÎĂ )2á41FFގČýčVČĹ"š$‹.űˇ1ç-Ž3t)¤¤ †-—ţFx,óě:?•čRȄYóč)c Ĺ]Ş#ňş2;–U°Ińđ éë] YufíIŚƒÁíTGäyt#d[<łFž˘đJ4LŠV‘t‘ýžő8Ä.‡Â¤T$”ěoDy ٖuٌU^,/iۚąË$cdp;X=ĘęîDY•u0ş'Âľ*%Łž—Œë(ОśeUĘčßVÚ K†ŕq!ë2`H’ČčÓ’†{w›q3ýWĚÝ3ˇË­­UM9Ç#˙Ž’2Ÿßý ]`ÁVî ˇ 9ĺ€ř•’şăo—ŞÉŃ`ó’ÁšâV!˙”Â‡L,- OzápHMp‹ËE0m ,N—ýČéc´o˘úrőË…lŞ(ŮIיŇMdÔ4žĆeBN^‚é[ĺĄôšČÓ<QđÜB#Sg!_†÷vÁ’tyz€Śv‡ˇ{A}?՗g6yIÉŹ>đ@-Ţ `!Ôh,+ű2ŹÉ‰¤ÝٕĽşźŐË|‰Ď*¸c ŮF^X˛>SúĽĺňy“ú0śL‹VÁŞ/Ă<řěɁĚó2ž”퐾ŢGňäÇQĺ˝IM!śŒ¨xa‰Őšs96MÓ´—~”ľzUńőˆĆ҇hé—OŁÜt ą†;\ATTNŮ4MÓrňLŠë´˝[F`Í´2É(čbNݢĺsę7ň/6źŢcŢţÚ^%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:46+02:00S5§OIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/quad-out.png000066400000000000000000000034671216507631600206340ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹`IDATxÚíyPUU€?6ń‰Š˘‚Űh‰ ęਚeĽ‰¸€‰ŕZ*6š3Ł9“ce:““•S8šäd† ¨ˆN:î˘"jJbf’.š JŔˇ?~$’ ëăÜ÷îýfî{ď2üîůćÜłÜß9ĎEÓ4 ÝŕŞ:“’¸ŤŔąioƒťŮňs3 2sKžŢ<ܞţŰÇBąŮlŞŻĹáHůާƒÍ'š`ľAĘmń,2ćAŁR„¸˜mHĹ)Ôŕřu8–ť/A긒YňœőÁť.´ń†îÍÁĂÚű€ĹÚzŸ×ť%¸•Ň`˜BĘá~l˙6¤ŔÉp/§řł&ôƒ—Ű@°?tm-ŐűڐRČ´Büyؒ {˙‚Üyżq]č×=ÚBćĽˇŐÁR„œżˎAô°5§ ęŔ°0Ś ďő<ě‡á…X ţwX~Ž\•÷Ü]!´#źŃ †ś/;KxĂv{­°ć4,9×Ę{ޞ0ŁLî]}ŐÄe8!9đu,űEÚ ÂŸŰ Ą§Úř #ÄŚÁĘdřxżHéÍě á]ä6Ľ !dwźťSĆ " „×ځ‹ęŕţ‡S Iˀ…`ýYéEľj ÂÔŕŚ7E8Ľě|řę8,> ˙䁋 Ě}搆[Ď8=iđV\+ę9 k_C猪#ŤN#ÄjƒOI7ś :5%ƒad'pŐéíŠ4œBČŠ›0=Q~Lď _Cý:Ş#Ť<-$ĎŸ–ZaľŻD ƒą]UGVuVȃ\x=]‘×cş@ÔpđóRYőpH!§nBX,\̈́FuaeŒsŕZń$'dE2źżZĄƒl#‚œ‡’ďě€ugäu°?l—‡D΄CI㤽pw…Ď‚`V_ýŽśŤƒî…œšĄ›d ×Đb"d°çŹčZH\*LüQşˇš@üxpwUŃ­¨$˜˝4 †řKÍh\WuTöG'OŠŃ€EaöĎ"cfHœ`  ł˘iR+˘’äő{ýaię¨j] ™ľ–'ÉtůŠđö Ş#Ş}t!$ˇ"6΋23ť2D&ˆr!÷s`ňO"ĂâŤCŕÍnŞŁR‡R!wł!(~˝wŘ6ˇS]$jQ–(—/}'2üꋌ>­T‡z”Ԑ<ŒÝ"2|˝`ďdIT6Q0É-€ŃąĹmƖ1ڌ'ŠU!Ö'zSH'Yä&ĹÔÚ-KŚ&É0đ2Š!˙Ŕ7ýuÜ a‚)Ł,j喵č L‡¸¸HB)ŁLěŢí=ăˇĘńęPăŽŔ+Š]kȎ‹/ÇłűÂ4SFšŘ­†O‡ßKĎ*Ź3ĄKűaňlěҨ_~!EFhGˆĺÁ&ĺSăĹtă ]/óT˝ZÂşQڌĘPŁE•S îÉÂů؈ęŻŰ65*dÎNÉ*lbýS ]c՗çxԘĽGaŐIɛú!̔QUjDČś đá^9^+Ť™ÖrĚmŽ•§„\¸3śKúçGĚ5ľM !V›dfĺÁŤĎÁüWT‡g vpAgdK•:f‹­IDATxÚímL•UŔ7aDhFĚ2ÓłąůŇr:łWNŤYm­ň%ŞÍšUÓ^ŸęC™šĽšŃԙ˝°Ôr‰/}ŔB 5@˝–ˆ˘¨ܧț]îűsďĺň˙}9g÷9Ď9ĎîózĎs°†a „ Á~忨sä‰c×RiYɑ˙żnŃ>$pœh†QĂĐx°–@´!ÚdŻţ›ssË0l†ôósűN§BDő98ÔÓ pxßéTH€ŘzT…ăÁâ$ ßÖJ87Çy:N^„ŁM“ ŁS§U!`}ľ„gƒĹâ<­ 1™.l<$ńůc]§W!&óSXŰ`Üí0!Ăuzb2kŤ$t6÷°G…˜Čš+đ]-ÄEÉp×Tˆ‰ŹŠ‚N;(áóă!Ââţ}*ÄjÎÞS ܘ{ŘŁBLŕÝJ™. ńƒ<ťW…ř™KŇDGÂk…žßŻBüLéačč‚Y÷ŔÝ)žßŻBüLé ݝފ ń#ťę`˙¸-Śey—‡ ńđöĎ9b˘źËG…ř‰ň:Ř{†Ä@‰y/*ÄOŹěŠ%…"Ĺ[Tˆ(Ż—Ú‘Kň}ËK…řˆʍř’|‘â *ÄGzűŽäXĎVuűB…řHoßńJ¤ÄúžŸ ńűŽXX:Ń?yŞXY!áŇi˛ü ń’]uP駑•=*Ä :ş d§Äý1˛˛G…xÁş_ĄŚ 2“|›•;B…xHËuXľO⍌ú6+w„ ńW€łm0& ćńţ*ÄĘëaC5DEŔşYi¡§BܤÓKvH|q> 3§â&+*䏌X9ŮźrTˆœ¸Ť÷ÉťŸĚ„ÄhóĘR!.0 iŞşl0ç>xt”šĺŠźłvž„ÁŃđţóËS!N¨h€÷*%ţŃt9Ôü2UH4śĂ‚m˛‹}á8xÎËm=ž˘BĐeƒ'ˇÂŮËňćě‡ÓWś qŔ˘íŇ\%ÇÂćbŮ4(TČ-l¨†ľeţůlY" $*Ďýg`qĎl|Ů$xĚä!Ž#ôźŹŽ7Ăä/ŕŻË0s$”Ísý’żh ţl)=2F§ÁŚâŕČŠV˜łĺ截ü)H0qiÄ^n j›o֌ôŘ1_Â`2`kČńf˜ÚŰLĽÂgáÎ!Á~ŞZC* x 4_“fj÷368ŘO% ¸˛Ś Śmy™°űéБ¨†´uŔë?ʎ€'FĂúŮçá[˛f3 „ÔˇÂŒR8vAfŕoÁ[EÁÚ:#Ź…ôÍşhťlßÉL‚/‡˘Á~˛ž [!˙†Ę$ٔ°š84FRÎ;!5M˛!a[Ď)Ňiƒaůƒ°(_śď„:a#äô%ř`/Ź˙ :şĺ$……ăd‡Hz˘\Ńď+O‹„Ň#ňë^¤Šs`őCĄß<9˘_֐捰ŠFŽą8`•Ď"zDźQ÷§ű ˝§_1€Cçŕ+|S+ďőuŮäZz‚œIőRܑě'őŇz]6§•×I 8Ü ­7݉•Ă]ććŔŒ‘ýŁłv— ő!u-ĐŢ)Ű3ë[ŕĘ ‰×4ÉDÎţ_ĽÄÉŕäť`JóţčŠPÇb†qŔ ľ|ËČÚ&_°=W;eôrdjëu8Óí7úÎ')FüȐpB†y›C‹aƋßçUć’™ƒ"ĺŻ:+Y~–\köF¸deDübŁdŢŕÉ…ý‘ÜÜ\˛łł^ł†aXŰŕÂUß JŒ–ĺ‰[‰‰ ÍuŁP¤ßĎC0Ÿ„˙6¤”Wţ4ú%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:46+02:00S5§OIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/quart-inout.png000066400000000000000000000032301216507631600213510ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹ÁIDATxÚíilUŔK/(´ÜB‹@h KĽ5€A°¸LąTŠQ"â ƄHˆGü ~€`"^H”[ĽÄŁF.%”BA %@)h ş@KŮśť;~ř{P҅îöÍ{ťż¤y3łÉěżó›™ˇďvX–eĆ6´S@˜ĆDŞ@G<>ů+­„ën9f'ŻřŽç‚¨ˆ;˙/$''Ż×Ťúľ.7ä•BaeôJyd§ŽÂ5w+Ďťş4#ÄÎCîäę-Č.€Mů°ç<Ô6šO‡ôç0¨´„ţë?KˆƒÎ1-ÇČDˆh&Ăż˛°ĺ4|• Ű ÁWw›v뙃aÜpö„ÔŢĜ7,y÷żż[ž ˆ‚,'d …ńä)h+BZH–îƒĹ{ŕ–GîüEcaÁcďÇk'„Ź—27Ŕž ˛?e,ťŠ+$…\sĂk!ˇşw€O3`ć0p8TG‚BθŕéPP=baÇ 0źˇę¨ę )!E.ˇÎ_‡„N°u–˝d@ qšaňz‘1¸;ěž ‰qŞŁş“¨ËňY0=N^…žń°ËŚ2 D„|™ żŸčș}l*B@H‘K }Ë3ě—g4Ĺh!Lß,?sÓűĂŤ¨Ž¨eŒ˛d/äKYcÍ3ö(g´„ąB ËáĂ?d{yFăY;cʐůŰ Ö'U"3STGă?F Ů^$Učí#aŮ$ŐŃÜĆ ńY°pťl/I]UGto'ä‡|8| zv„ˇGŤŽćŢ1NČG{$ý ÝżŚTťa”ż‹!ż úÄĂ\ ĘÍa”•‡$›ÖśÍށÄ!E.X{Ú9`vŞęhîc„|}HÚȧ9a@ŐŃÜ?FŠŞ…•y˛ýÎŐŃ´#„Ź; Ž[đx?HłymnK!dŐaIçRIëŃ^H^),^¤ŢJw´˛*, ^N“AÝŃZˆŰ#U%sŇTG´’sJzާ÷‡dÍ*ď†ÖBÖü#é‹ĂUG8´rŠRڔTŔˆDŐGu4ÁA!đEŽl›Đîq7´˛łK¸éU•4E!Ÿě—ô͑ŁiĐBHI… Ië ó ~]&B>;^ f “ň‡ÉŘ^HY•dć`śAíwĂöBŢÝ Ő0>IęŽLÇÖB ËáŰ#ဏǩŽŚm°ľŰĂҲœ0ŇЂ`Sl+$ť ~XÚây:ŔŚBĘŞ`ŢVŮ~/]żai­ÁvB,`Öf¸|Sf]X á°´Ö`;!Ÿ ąQ°fŠŮĽň氕3ŽúÁţË&ÁĂ˝TGÔöŘFČ͘ś Ęëz"ž>BuDj°…ŻŻý*=ŮoĎKŞ(RU s~†őÇdšÖďŚę3/I0PšeVÖ@ćFřóœČX÷,LHR}IÔ˘LČÍxŞNF|Œ<U_ő(ň×Ex%Ž˙+2~›ŁűŞžö M…”V¢°á¸Ź8ŮYa i!52ĺŇ˝2ŔŚC† -™(Ť„Š'hBÜŘy6ŔO'ŕzľý ŹČ ÍBŸ?Lȅ2}÷ąË2 ĚŽłRČy"&$Á[ÂäA˛Śy–eYű/śź~’Ď‚ÓĺőűŐP\!#™ Ędˆ@CbŁäiČrÂÔĄRŕ Ó2˲Ź7śŔŠƒ÷w‚žń-ŤĎôk_ eůtő”2¸ťž3ň›””’““›ýĚaY–uń\Šňďd‰q;‰‰”aCxQ0›Ąź.+LcţVŽŁŔäĚç%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:46+02:00S5§OIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/quart-out.png000066400000000000000000000032461216507631600210310ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹ĎIDATxÚíylUŔŰ-´ĺ–łÜH9zXjI9ÓHTT(cJ¨„PĆ#Q˘HLŃx4r$P¨DŃF h8 –b)RjleťPiať˙ř°uéB=ŢĚÎü’Ílw7ŰďÍoŢ|ófžykÓ4MĂB7„ŠŔ“pŐč‰úy”9ŕ†Űó}çu¨źęŸ˙5+:؛żŢ($//ˇŰݖď4Ž:(ýęęáěepnj„ŽĄŰ œuPYŐuňJ<Ż@´!śPĚ!×\PX{JĄřœžĺŐM[˙­ ŽvŃCśÚáÝĺő˜HčÝšůçGö›1Žév/ #$„\݇ýePpvŸ’ż<ߏ‰„¤Ţpo,$ö‚ž] g'Hę1QŞŁ÷İ9¤śž9ŰOC^)8˙ˇŤŮ҇@r˜rˇśč`a¸ňçUřŕ||.ţ#Ż…‡Á”Ą0;Žƒ~]!Ě(nÁ0=¤řŹČ‡żBĂÍMhÜČJ…ŒxčŃIu„ţA÷BÎ;aul*„ënIžs’a~*L¤::˙ŁŰ]Ö5źYo”ń€Ý™‰°ćAÔMutC—=d[1źđuÓ ,#–§CJՑ] qšáŮ˝’°îé Ť§Ŕc#Œs”ä+şR怹;áp…5-™ŻM†ťďßm$t!$Żć傣˘#!g&<:\uTjP*¤Aƒľ‡aép5Ŕřđé Ö]őjQ‡2! dŽÉßYаašěŽĚŒ!š‹ž’ämˇÉĄěâqŞW…>şk.ČÚ[‹EĆĆéđTŠęŐ ‚:0Ô4˜š rKä\ÓĆé0ϒáAĐzHĂÍÝTn D…Ăžš0y°ęć돠ĽĐ%ß6ĺŒőÓ,ˇ#(=dĂ1xűŘŹœŃ"ď!+ŕš˝ Ë&Y2Z" BŞj`îôeÄĂĘtŐÍŐ?ârËUyľ lžaÜŤxÁ$`Bď—…Ń‘űÜĄşŠĆ Bv–ŔűGä”ůçRéaŃ:ü.äœćď’Aŕ‹ăaÚŐM4~˛0OJrîŤPÝ<ăáW!ű~ƒď~—|ą5Ó|—üß„8ë¤w; &†`ş*Ú%¤Ě›OČ=rË&ŠnBhŃ.!+ňĽwd&HA´…˙hłÂ*řâš>ž<]uřĄG›…ŹĚ—ëăϤABOŐá‡mrźR*Ő#Âĺv ˙Ó&!Ť~‚ˇ…ŁaŔ]ŞCMZ-¤°Rnʏ ‡—'¨;tiľw–ŢąŔęĽUBĘŤaK‘ŒĘ_Ż:äĐŚUB><Ú4*ˇŽ–…¸ÜđŮI9WľÄʧE!2—Ô螐Ť:ÜЧE!kĘrÎ(ŐĄšƒ; 9yAJ{:uůE,Ď…l8*Ëě4ď3ŤYřŸŰ Šš[Šĺ$â‚ŃŞĂ4ˇ’S$3+¤†xë$bĐđ*Ä­Áú#ň<;MuˆćÂŤC’Đűw…ŒŐ!š ŻBţKć‹ŇŹŠ.‚MłŐí¨•™>#ěđ´•ĚƒN3!9E2ĽŢÔa2ż­Epi&dÓ YfQš9ńrö2œ¨’ëéCT‡fN<„䝑‹P™‰ÖÝOŞđ˛űŒ,3U‡e^…œwĘdö1Q0śżę°ĚKِœ"ĄĎJ°Ć*i\őۋe™•Ş:$spꢜ* ÷őS’š řňÔÍŁŤďżúb<ÂAnMłCœůäćVŤŽ)äINN&..Îë{6MÓ´?ވ”Q&˜ě^ďčöç*̊•1tĆżű“Î÷áź%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:46+02:00S5§OIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/quint-in.png000066400000000000000000000031341216507631600206300ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹…IDATxÚí[lU€ż-´\ ĽĐB¸(—śFD `!FĐr1(‰‰11‚Dc5˘ĆDCÔDPِ„XDą"Ő¤ŠÔp‹B”[ ”R´)Ľ-P–śŰÝńá/‚şŰîefvK˙ďĺLvÎůϤ_眙sŮ5LÓ4Qb†NŃžĺߨ‡9R[Ž‚Çë˙źëĆA^^^Ż7ظJ˜źzňnŽ6 ¤ö%čÝů˙ç íCœĂíäwĄkg¨zşř˘M–ƒě*ƒ†f˜•ć_¨GÉ/•ôó¨É/…ΆÜ!P!qę”Ô@F J œO…8Ä%’śÖ\ qŒŸĎJŞBb„ÂrHě S†´žO…8ŔoĺP×÷ WqâێK:cXŰyUˆě,…NĚÓv^b3E•p˘F%CZRŰůUˆÍl=&éŁcƒËŻBlÄ4áë–ţc ‰>‡Ť¤šJO†ŹÔŕʨ ľšb+šĹ’.|b{Îˀbz2dĽ_N…ŘÄŚĂ`KłŔ0‚/§BlŔíÜcň2¸$3´˛*ÄňNÁ%7dßÜËŕ­¨ŘpHҧ&„^V…XLíu(8+CíĽ‡^^…X̎höÁĂé"%TTˆĹÜjfd×*ÄBÎŐÁw§ Ť f /† ą€×K3ĄW|x1TˆE¸=đyËÓŐł“ŁB,bó¨mE ú‡G…X€×„öÉq$w¨KŘ~Ž]„‰0wtdąTH„˜Ŕű-wÇËSŻj!gdÝUďxXvgäńTH„ŹýUҕ“Ąg—Č㊐(,—ť#)VÜcMLtĹdi˛Ź@…„É™Zřć8ÄťÂf„ “ˇ Áăƒůcäq×*THUƜšaŔšlkcŤ0x}4yaYŒékml";K`űIbk†őńUH44ĂŞŸäxŐäÖ7o†‹ ×~‘ľşƒaőT{ęP!A˛˙ŹŰ °~ô°ŕ­Ü*$šź°ü[Ů^đäx˜=ŇžşTH|vŽWĂŕDX7ËŢşTH­‚Z:ň7ŚCŸ{ëS!­pĽŰ*óĺłŇŕń,űëT!­°2że&°'lœŰös+P!řřŘP$3€_΃ÔîÎÔŤBü°ű<Ÿ/ÇkŚÂ´ĄÎŐ­_ń÷ö_€ű7Âľ&xd4l[چ›HŃ;äŞÝ°hŤČ˜96ĎsV¨¨vĂĚMPV'›lrBˇ8çŻC…ĺ—EFQ%¤ö€í‹ĄW[ ŹŔyˆöÍž ˜˙üyRşCÁ2×/z×ÓĄ…l>O/}Ƹ~rg„ş'Đj:¤fŹ.€÷öĘşÜG–ůĐ3JÍÔ­t8!%5đÜNůĘVXu/Ź›éüÓT :ŒŤđćnYĽîńAB|2ǙńŠP¸í…x|đEŹ)€‹nůlQŹ&_*kÜśB›aăaY?UV'ŸMďä@Îđh_]`n;!'ŞeBéӃpšA>Ń^Ɇ%ávťi÷Bź>(­•N:ˇöTČTŤaŔôĄ°|,ÎpfčÜ ÚĆf(ť,ŤÎ< …ç ˛ţćůÔ°p,<1îíŤ ˜í=E&‡Ž{ ´VBqœŽkž›ůşĹÉ&ËŮŁ`Ň@ČűÍRk¸öVŔÉj{*¨o‚ WýŸ+Š‘&Çí‘ń$€šëPuÍţ—<M‘7ë‰ý!' âÚIs †išć3;`ýďŃš€Ţń7÷V K’Ÿ2€ôž@c=\,†úżHN€áIсľšĚĚLŇŇü˙ˆˆašŚYqE†ŸídD˙ŤŤSűép fűŽŠţoĆą@xzoH‰Ś%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:46+02:00S5§OIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/quint-inout.png000066400000000000000000000031441216507631600213610ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹IDATxÚí}LUeÇ?Ç 2D|I|ař‚2,Vş¨a–ł,S—f™nnÔ˝,kÓZ[Ť͖•ÓľľŮ۲ÎÔi/XÚË|!Rţ`3E°D„ÔHšňr9ýńÓ ťÖĺŢĎyž{?ŰÝópî8÷{ůpÎsžsžóËśm›ŽĄęţI”ę:`-íĐŘgţě\~ć"4^n &B´çßË˙RPP€ĎçSýݕămƒCçŕh­‡Ö”:b(;ŐMÎ~΅ Á+҆@‡ ť*aËQř˘ Î7wžŠ 0<&%ÀŸ֕÷cŁaôŔîć”Ŕă§Ák!í°éäí…ău˛,Şܚ‹3!#nń1˝—)lېăő°x+”œ–ŸG „ĺŮ0?Fńďa)dĎIxp3ÔyaHțšYă qĹvB֕Ŕ˛oÁgÔ°í!H‰WŞ“°ňňnXY(ő‡3`ý̟¨:Mčh/d÷I¨m–Ámi‰ŞÓ„ŽöBž*—rIŚę$ΠľŸ Ű+¤Žsߣ+Z )=5MpópHîŻ:3h-äë+ťŤšT'q#„ĚKWÄ9´Rç…ge¤zF˛ę4ÎĄ­Ý•ŕë€ŮăäžSĐöŤ’rÚhŐIœE[!ť*Ľw~çŐIœEK!5MPV cÁ°8ŐiœEK!?œűg¤ŞNâ̋QţĐJȆĂĐę“ĆÜÄÝh$ÄFŚÁs.FůC!ĽŔžjHŠ…{ÇŞNÓsh#äŁRćfÉ)SŃBH×QíeŠNÓłh!¤ë¨öôÁŞÓô,Žb۰śXę:j× ůî7Ř_Ł˙¨ö@q˝ź˝RŽČÖ{T{ ¸ZČś2(Ž‘CÝeSU§é\+ÄŰ+ž—úňěޝ÷P%ŽňZĄÜb0> V¸|'qĽŇs°vżÔßŃl&†Pqo<˛Uî5Ÿ;f|šÄŽ’ˇWśŕƒ9ŞÓô>Žňă éZ|8†2€ş;¸FHÉiX¸EŽw,löÝ˙ÂB *ŕî|9_•=Ţ˝Ou"u(ŇaĂę}°`\đBÎ(Řš$KJ|DÂU233IKKóűžeŰś]Ó$ł!ĂŘAťĺ˙Éc',žŽ ‘&Őeüƒ˝u$ߢ+˛%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:46+02:00S5§OIENDŽB`‚libclaw-1.7.4/doc/doc-img/tween/quint-out.png000066400000000000000000000031251216507631600210310ustar00rootroot00000000000000‰PNG  IHDRdK†"ˇbKGDţţţëԂ pHYsHHFÉk> vpAgdK•:f‹~IDATxÚí{L•e€Ÿs¸jŕ%sN …ËŚ”ŠSZMË̲ĐÍ´Ťkĺf—1gn­šn[[ÎUŤie#3#Á– cZ(‰:Đd ژ$*ČĺđőǏ0ĆQœó}ďšźĎĆŢď;ö{ż‡ďźˇß{°†a ńěŞĐô%XuVÓîÐŸĘżżŚö2´ušÇŇť $¨˙ă˝Bňňňp8*Ż•Ű4ľÂąsPó qÉ=†‹­pąU^ÓНݪ#…ć×!։›Żś!ÍmPP Ĺľp˛ N5‰gľ™#¤ÓĹu[ G ¤ţĆs!v Éq05^ĘéŁ!"X$űPKéőmČŃs]ŰËáüՏ'‡y ‘ ’`d„ęH=ƒW éę†ě Řz ŠjĺcČf“Ű|E*<‘,w„Mu &ŕUB ~üÖţ g.Éc1áđLŹşŚÜŽ:Bóń!ŕů=p謜'ÄBÖlX™ a^Ľů(ŻjóuX—ێCˇ#"ŕŐtxé^ˆ Uő(íe•6ÂS;eÜb‡ĺŠđö<¸c˜ęˢewHv<ˇŽ´K×ô‹Ç ýN՗C=– é6`cźU,ç a×2ćÖŻő,ŇÖ+sŕťSrţĘLx/ánfc™śNxôŘW-íŖ…°:Muő˝K„´uÂâ"#*ň2an‚ęŞ{'–É:Uҍݓ sTWŰ{1ýÓűý_ŕòAöR-c Lňu9źV ÇYłá‘IŞŤëý˜60ü­Ň?—Ĺ uéŇ›Ň Œ)wHK;dî‹&ÁŚůŞŤé;˜"dUŽĚÖNˆ…/—čqĆ`đřĽÚR*żĐ Řţ¸,—j\ÇŁBŽvŔúB9Ţ4_ĎM  Y—/ÉłĆÁÚ™ŞŤć›xLČžjř´ ě6š;lţ¸žjrĽVçĘěšzđçňfĄdűMĄť¸î✐ň °šTŽ?^˜ËŽžÄm! %‰my ̟ ş:ž[Bö×H&ax0źł@uUüˇ„l,’%Ů53`\'&x’! Ů_ëd$žţŐŐđ†,äŁ#Rž<bőôˆÇ’˛s×Óvźxę*řCňî!i;V§A\¤ę*řƒRÝ 9§%ßöűT‡ď ZČżB‡–L ě”Oł”ŚkđŐ YpZ?[učţÉ „l.•‰Äy ˛uLăy\Ňî€OŽĘŽĽ sT‡íż¸,dG…ěń›>îŻ:l˙Ĺe!˙jĚĂ%!%ő’g OOS˛㒐Ďʤ|6 ‚\y‡f¨ (ÄŃł36Ř/čiÓPČázř몤ô聠ů (dëq)š¨:ÔŔŕ–BŽuŔˇ'ĺxEŠęPƒ[ Ů])‰Ó&ÁřŐĄˇ˛í¸”ú› Šo5O&Ť3p¸Šď—.oć4ˆQfŕpS!;{ö’ëťĂZœ Šo‘é’řH§k5N…䜖/[ vpAgdK•:f‹]IDATxÚíkpLWŔ›M"^xÄŁU*Ľ‚´´čĐAQR&MA=ÓéŕCM;55ĹL?hŤĄŁ3>h:¨GČ6H2‘ÖŤÚbPń&UA$XÖ#‰ěćöĂ?!6›Ý˝wwĎďÓÝť{Ď=ťż9˙sĎsMšŚi( CŢP<Šâer ő”9Ş?¸ň ++ ‡Ăálş Č˝ÂÜËC)u˜°Î„Fć'?cRuˆw(¸ o%Õ;đ^;Ř8ĚŐÄ'˛źŔÝűťJdt‰„´¤ęe€âqŒ[Ç ĄeCȍ¾ţy%ÄĂĚŘ ™§ ŽÖ&Aťˆg^ ń ‹öÂÂ=rź|8ônýük”‘}>Ű$ÇsűĂčÎÎ]§„x€—aě:°—ĂÄ7`VçŻUBÜĚ ˇ€­úľ…Ĺqdrţz%č—A˘ňoA‡&°n„×, %ÄM”W<Ţć@Óz°a,4Š[ót”71s+¤Ÿ„P3XFBűĆŽĽŁ„¸äý°`7˜LđS xĹő´”Z’źŚeƒŚÁě>0ŠkíŇS‹ľ`G> Z Ľvř¤'ü8jđ@U-Jˆ‹\˝o&K/î¨Î:˛ö2@…,—(ź WˆŒčڰ4Ţ=2@ Š1Ĺe”šEĐŞ˘÷ś~¨űŇWBj@q$X`űyh ['@ű&â$šS˛aË)>„čfâ$Ó˛aĺa0›¤K¤_[ĎÜG q‚e‡¤˝d‚% ĺš{Ő°ë+đH?S˛@ž ÝéžDľCžANôY Ľ`Z5‚=STČz 9ťRd mď BVľě+€Á+áf‰ŒƒŻIôŽ P%ä ňoABŞČčŐ~/ÔńŢý•*ŘJ!nľt‰tŽ”Ů…Ţ”JČlĽ0$ŽBd}řmŹ÷e€<”ąëD„ÉđëËáúä%ŕ+u[)źŸť+dlš=Z闟€.!örř8Kd42€ `!örż~͕‰ ™cô—*Ä^_lK.„Éh_ß6zçJ¸:Ä^ŇeY™ Hţ†wÔ;W (!•aĘRŚ–ÄĂř×őÎŐŁŒĘ’ń L%Âđh˝ső$!äń’‘:ŇXaŞ*~_Š?Q2 ,ü\H™ăa^9çÖČ2ŔCVŐ¸ŃĂTUü˛„ܖžŠĘxúhߐ~XBöŔ辐g…ˆş°y#}îÂg…—É"Ëô“ňzFo˜7Đ{łC<…O ɳ ž*ˎ …şé+÷ŕsBśŸ—ő…wew5#<7ńY|Fˆ˝žŰ _o—Ů„][@ĆhŁÓdOáBn–ŔäLȨ¨/Fw†Ľ P/DĂ Ůu&fŔ7¤žHŽƒ žŽ'†âĐ`ń>řtŁ„Ť6á°:Ńš=§|C ÉłĘôœmgĺub4, ݸ¸Ň¨NHĘ˜š wîKďہ0ľť,%  #äôu˜ľ ֝x˙śđs vpAgdK•:f‹RIDATxÚíiPUe€ŸËŚŚ(˜bcŁš‘K˘™Ë ‰%šR"ʈëXc“5Nij5ĽeM٢IĽp”1#TT\2\PKJ0wÍށ˜€ x/§Ż%—ťœsî=Ď 3waîyď<ó÷|ç{ßďšEQ0Đ ^j`đo|ÔŔÝąTÁĽb8^%5ŻżŘ|˝ďý˙ťB222°Z­jÇŻ{*ʰů”7E-űRčĚŠkP\qď˙] ęb2rˆýÜŽ‚g!í8dœ‚Â2yÝd‚ŽAĐĺÎ_× x´šźŢu$ CˆÜŹ„¤Cđف ž^ĐżL y#Ű>ÓČ!  Ň )ÇŕŁýpٌô€ŃC˙†ś!ÄFvŸ‡—2ŕěZÂâgadG9Eً!¤žWŔü]°ü0X „÷AÂršr†zpÄ ńipşHžż ŸDC3?ÇËň,Uđé/đ~–\Iľ€äQŐŢyÇ4„܇ŤĽ0& ~ž(ĎGw‚ä‘ŘÄšÇ5„ÔÁďÁ°ďŕâ đ÷ƒĺĂ!!Â5Ç6„ü‡Ěł0*ĘoËԖčř°ëŽoŠEj.LŮ$2ž …Ô1Đę!×Ć``A,ÜŠĂ:Ŕ†xđóś÷“mǸýĚɄ{f=é*É!•VHXë˙°4föQ7&Ri…që ý4ö¤çaZOľŁň`!óv‰ ?oX7Vň†đ¸˘ł3á‹lš¸r”vd€ ™“)ë&`éP×Mřę‹ÇŠweh ×…Gä…Z#Ă$#C‹2ŔC„|™-2ž ŻjTxŔ)+óźł[/˘mŕćB\‚ŃßCšâşŔýԎč˙q[!Ç 6ĘnËemJŹcÖź[–żý’e‘ŠGkȚ -l,ÇQ ˇ!߂kEF÷֐™¨ŕfB*Ź—šâ›â]żža/n%d֏°óœTƒ¤ÇĂcjGd;n#äólŠ™ň6ÁęXčÓV툆[I?óvƌüĂg¤ŚVŻč^Čá<˜˛Qꌌö„šԎČ>t-ä⠝ 7*`p(ŹŽvDöŁ[!ů%ľ ŽC§VR”ŕŁŰoSƒ.ż‚Ľ &n”V€°@Ř1Áö> ­˘K!ł3ĺňÖżlíZ¨‘ăНoÁ’_ĺńŠáĐ9Híˆ‹Ž„l; 3ˇËă˘`|7ľ#r<şrě*ÄŻƒ*EZÇćT;"ç  !ůĽłJ+ĺňöëa༃[é AóBnY`äZČ+ŽÁ°ćhâĆ Ďš’°^făÁM!-iŚvDÎEłBExú hâ+#Łs+ľŁr>š2o$”\‘ŃajGä4)dŮAiś4™¤lŞŠ ]…ć„ü Żo—[ésűĂô^jGäZ4%ä¨flŻő…EƒŐŽČőhŚęä¨݆kĺ0 ěžäŘô‚&žrŽ˘SDFdlď™2@BrĚ0$Eś7Š ‰ŘXí¨ÔCŐ9om˝Cŕ§Dđ` bšT ˝VԒ1ÁůŰVčUFH^‰$đÂ2čŐFŞ =}dTăr!9fšsk.••ž´8CFm\šÔť"9Ă\ ݂aĎ$Y7¨Áe#dÍ1˜–ÉĆiŞn\2B’BâF‘1˘Ł$pCFÝ8u„XŞ`îNŠťé`ú8Ús'}őÁiBŠĘab:l=-ˇĐß ˘¤%Ůŕţ8EČĄ+RČv˘P–[“GÁ87ŹqbŠ‚…{eƒaŤm›Ă†ąúm P‡ 9SÓ3 ë‚ vpAgdK•:f‹CIDATxÚíkPTe€Ÿĺ˘ˆ ’˘Ł ˘˜7Ŕź¤ĄŁy'óJ*a(Z‘ůç&'G­d—ÉŹŹiL§1ŻDŽĽ‚)š9š÷Ë ‚…ą˛Č˛ýxU`\”ËťçůÞ]vö=űĚwžď{ż÷;Ť3™L&4Tƒ‹ŇhÔÇMéc Üź Eňˇ´˛ţës€ťëĂď{ $55ŁŃ¨ôyŘ%eq݅2űSzü{§á÷”Ź€f„č´>¤éUŔ‘<ˆ;×ŕVÔýýź ČÚşĂ@_čó´q‡žŢľ˙3ź¸šé04!$ťĎCâ98qłöy7AaTw˜Đ ź[7˙s´>äT×Ŕţlřä0d\Żmţ^0˝/Œîa˝Áˇ­ĺ>Sb†›ˇaÇ_đĺ1Č/“ç|ÚŔź ˜?BýÁUgĎքÔáŸŰ°ţ|ž†{㛧şŔ˘Á3źZp)j,šŕL!Äf@Ęe¸{OÄĚ~°ě`˝Ö`§îԋďŔÚðţ(TĄľ+DĂ+ƒE„8m ůö$ŹLƒÂr9Ž †'Őš*Ó 9’Ë÷AÖ 9ÖօÁذᕩAœFHžV„]§án tô„UŁáPpQƒ‰{8…¤‹đZФ2\tđęi>JGö0-¤Ô+ŔĆ2Š ő‡of@pgĽ#k‡r –ě–”‡xk$ź?ARjFĺá5Ł ><ďeJę#Đ6ςą=•ŽŹq8”ü2X”i9rüú0ř4 ÚľR:˛Ćă0BţȇšßCž^RëÂ`ńPĽŁj:v/Äd‚~‡ŘL™m÷ëÉó 'Ľ#kv-ÄP 1ŠwZŽ#ƒáëięÎ6ťršÂŕÂ-™[|1–ŽPÇlť%ŘĽců0'A:q?/Ř{)•e°;! ç &ĘŤd˝:}!ti§tT–Ăn„M°&Öü5&˜ŇâçślýZŘ…ęˆN‚řłrüf¨ kՔ´ŞR]oď­\ፊö9żh,Ş˘7@ԏ°çŠŒž6L“ľmGFľBôx>N”Ü]`k8D…(•őQĽÜRxn'\,’ň›} ŕénJGeT'$ˇĆo“´šŸ$G: P™ş2zűŔÁEĐCá˘[ٚý!š ABrKa‚&Pű-ăj‰Źî9ł PXČńˇľśe¤;š P°”4ç?ś J*eCKÚBM(4ĘĘ-…IŰEĆ?Řm›Ęr{Ŕć—,˝ŚîŞ˝L%Fh2ębS!zL‰ƒs…Đ­˝Ö›ĂfBî猲ň ƒüű§ŮBb3ĽÄłťdn5–ĄYBĎËž>tŕ“z+}ŽC“…ěš"[L&X:^ Rú‹&M Ŕ˜-˛Ůň…ţ!Y\ ËŃčŻ3OSăDĆ´'e÷’&Ăň4ę+-Ż‚‰ŰeÎ1´+ěœ-›g4,Ďc…M03ŽËxb„ʉkX‡Ç YśŇs¤T'~Ž”îhXG ů, 67Ř2 Fú+ŽăÓ ¤‹°â€<Žł(Şs`VČŃđr˛TŒÄ Uc”ÓyxHHv Dţ ľTă`Ó ĽCt.ę )ŠšĽĐˇ#¤źdŰť:kÔRe„…Iđgtň”Šôövt'6Gၐűm­\aO”VwŤ.ŰNÉW§“á­VĐŚnGóĺ Şë%<Ż^ ůŞŇa96!!!š}Mg2™L7ôňKƒşŘ˙Ůě§ţš 5˘%ĐUĆ˙ŐRçŐ¤îë%tEXtdate:create2011-06-10T22:30:46+02:00"hó%tEXtdate:modify2011-06-10T22:30:46+02:00S5§OIENDŽB`‚libclaw-1.7.4/doc/doc-src/000077500000000000000000000000001216507631600152465ustar00rootroot00000000000000libclaw-1.7.4/doc/doc-src/containers.dox000066400000000000000000000006371216507631600201350ustar00rootroot00000000000000/* -*- coding: utf-8 -*- */ /*! \page containers Containers Claw provides various containers for some special purposes. - \ref container-multi_type_map - \ref container-avl \section container-multi_type_map Multi Type Map The \ref multi_type_map "Multi Type Map" is a map in which values of different types can be associated to the same key. \section container-avl AVL Binary Search Trees See claw::avl. */libclaw-1.7.4/doc/doc-src/curve/000077500000000000000000000000001216507631600163725ustar00rootroot00000000000000libclaw-1.7.4/doc/doc-src/curve/curve.dox000066400000000000000000000245161216507631600202420ustar00rootroot00000000000000/* -*- coding: utf-8 -*- */ /*! \page curves BĂŠzier curves The claw::math::curve class is a C++ implementation of the parametrized curves known as BĂŠzier curves. - \ref curve-introduction - \ref curve-curve-class - \ref curve-control-point-class - \ref curve-access-control-point - \ref curve-add-control-point - \ref curve-resolved-point-class - \ref curve-section-class - \ref curve-section-point-computation - \ref curve-section-properties-computation \section curve-introduction Introduction The BĂŠzier curves are defined by a starting point P0, an end point Pn and a sequence of points (P1, …, Pn-1) controlling the direction of the curve between P0 and Pn. The points of the curve are then defined for a given fraction t ∈ [0, 1] of the length of the curve by the following equations: \f[ B(t) = \sum_{j=0}^n \left( \begin{array}{c} n \\ j \end{array}\right) P_jt^j(1-t)^{n-j} \quad t \in [0, 1] \f] A \ref curve-curve-class "curve" in Claw is defined by a sequence of points pj through which the curve goes. A \ref curve-section-class "section" sj of the curve is then defined as two successive points (pj, pj+1). The equations of BĂŠzier, restricted to the cubic case (n=3), are used to describe the shape of each section. This shape is controlled by the output direction oj of its first point and the input direction ij+1 of its last point. The equation of a section sj is written as follows: \f[ B_j(t) = (1-t)^3p_j + 3(1-t)^2to_j + 3(1-t)t^2i_{j+1} + t^3p_{j+1} \quad t \in [0, 1] \f] One can then build complex curves by concatenating several sections. The library provides the following functionalities: - use any type for the coordinates, as long as their traits are defined, - defining a curve as a list of control points, - computing the point at a given t on a section of the curve, - computing all the points of the curve at a given x-coordinate, - computing the tangent of the curve at a given t. \section curve-curve-class The curve class The curve class is defined as follows: \code template< typename C, typename Traits = coordinate_traits > class curve { public: typedef C coordinate_type; typedef Traits traits_type; typedef typename traits_type::value_type value_type; // see below for the details class control_point; public: typedef implementation_defined iterator; typedef implementation_defined const_iterator; // see below for the details class section { public: // see below for the details class resolved_point; }; // class section public: void push_back( const control_point& p ); void push_front( const control_point& p ); void insert( const iterator& pos, const control_point& p ); section get_section( const const_iterator& pos ) const; std::vector get_point_at_x( value_type x, bool off_domain = false ) const; iterator begin(); iterator end(); const_iterator begin() const; const_iterator end() const; }; // class curve \endcode The curve class is parametrized by the type of the coordinates, named \c C, and the traits to use to access their properties, named \c Traits. The class claw::math::coordinate_2d is a good candidate for \c C, but any class can be used as long as Traits provides an implementation for the the following interface: \code struct traits_interface { /** \brief The type of the coordinate. */ typedef implementation_defined coordinate_type; /** \brief The type of the components of the coordinate. */ typedef implementation_defined value_type; /** * \brief Get the component of a coordinate on the x-axis. * \param c The coordinate from which the component is taken. */ static value_type get_x( const coordinate_type& c ); /** * \brief Get the component of a coordinate on the y-axis. * \param c The coordinate from which the component is taken. */ static value_type get_y( const coordinate_type& c ); /** * \brief Create a new coordinate from with the components sets to the * provided values. * \param x The position on the x axis. * \param y The position on the y axis. */ static coordinate_type make_coordinate( value_type x, value_type y ); }; // struct traits_interface \endcode \section curve-control-point-class The control_point class The \ref claw::math::curve::control_point "control point class" is the aggregation of a coordinate through which the curve goes (the position of the point), and two points defining the direction from which the curve respectively "enters and leaves" the point. Those input and output points are relative to the same origin than the curve's point (i.e. their coordinates are not relative to the curve's point itself). The interface of the class is as follows: \code class control_point { public: control_point(); explicit control_point( const coordinate_type& p ); control_point ( const coordinate_type& p, const coordinate_type& input_direction, const coordinate_type& output_direction ); const coordinate_type& get_position() const; const coordinate_type& get_input_direction() const; const coordinate_type& get_output_direction() const; }; // class control_point \endcode \b Note: building a control point as follows \code coordinate_type c; control_point p( c ) \endcode is equivalent to the following code \code coordinate_type c; control_point p( c, c, c ) \endcode \subsection curve-access-control-point Accessing the control points of a curve The control points of the curve can be accessed using iterators implementing the concept of ForwardIterator and BackwardIterator. The \c begin() and \c end() methods return an \c iterator respectively on the first control point of the curve or just past the last control point of the curve. If the call is done on a \c const \c curve then a \c const_iterator is returned. \subsection curve-add-control-point Adding a control point to a curve Several methods can be used to insert a control point in a curve: - \code void curve::insert( const iterator& pos, const control_point& p ) \endcode will add the control point \c p before the control point represented by the iterator \c pos. If \c pos == end(), then \c p is inserted at the end of the curve, - \code void curve::push_back( const control_point& p ) \endcode will add the control point \c p at the end of the curve. This is equivalent to \c curve::insert( curve::end(), p ), - \code void curve::push_front( const control_point& p ) \endcode will add the control point \c p at the beginning of the curve. This is equivalent to \c curve::insert( curve::begin(), p ). \b Note: Please note that inserting a point in the curve between the beginning and the end of a section will invalidate the section. \section curve-resolved-point-class The resolved_point class The \ref claw::math::curve::section::resolved_point "resolved point class" represents the result of the computation of a point on the curve from an other parameter than t. The interface of the class is defined as follows: \code class resolved_point { public: const coordinate_type& get_position() const; const section& get_section() const; double get_date() const; }; // class resolved_point \endcode The interface presents the following methods: - \c get_position() returns the coordinates of the points on the curve, - \c get_section() returns the section on which the point has been found, - \c get_date() returns a value of t such that for a \c resolved_point p, the following applies: \code p.get_section().get_point_at( p.get_date() ) == p.get_position() \endcode \section curve-section-class The section class A section describes a part of a curve represented by two successive control points. One can access the section starting from the point represented by an iterator \c it in the curve \c c using this code: \code section s( c.get_section(it) ); \endcode The interface of the section class is as follows: \code class section { public: typedef curve::const_iterator iterator_type; public: section( const iterator_type& origin, const iterator_type& end ); coordinate_type get_point_at( double t ) const; coordinate_type get_tangent_at( double t ) const; std::vector get_point_at_x( value_type x, bool off_domain = false ) const; bool empty() const; }; // class section \endcode \subsection curve-section-point-computation Computing the points of the curve The main procedure to compute the coordinates of a point of the curve is to obtain a section of the curve and call \code section::get_point_at( double t ) \endcode to get the coordinates of the point at a given t on the section. If t is unknown, one can use the method \c get_point_at_x( value_type x, bool off_domain ) defined in claw::math::curve and claw::math::curve::section to obtain all the points of the curve or section having the given x-coordinate. If the argument \c off_domain is set to true, then the following applies: - for \c section::get_point_at_x(), the resolved points found with a date t such that t < 0 or 1 < t are kept, - for \c curve::get_point_at_x(), the points found at a date t < 0 on the first section of the curve or at a date t > 1 on the last section of the curve are kept. \subsection curve-section-properties-computation Other properties of the curve. The \c section::get_tangent_at( double t ) returns the tangent to the curve at a given t on a given section. */ libclaw-1.7.4/doc/doc-src/main-page.dox000066400000000000000000000033421216507631600176220ustar00rootroot00000000000000/* -*- coding: utf-8 -*- */ /*! \mainpage Claw is a generalist library written in C++ and providing various structures and algorithms, like \ref containers "containers", string algorithms, \ref tweeners "tweeners", \ref curves "BĂŠzier curves" and more. - \ref main-presentation - \ref main-download - \ref main-licence - \ref main-contact \section main-presentation Presentation The story of Claw begins when I wanted to group all the small tools I have made along my studies at the university. The library progress from time to time, mostly when I need a new tool for Plee the Bear, a game I am actively working on. Claw wants to be standard compliant and as portable as possible. Of course, because I'm currently the only developer, the task is a little bit difficult and you could have some minor problems. If you experience any problem, please let me know by \ref main-contact "contacting me". Claw stands for "C++ Library Absolutely Wonderful". \section main-download Download Please check the SourceForge.net project's page to download the library. \section main-licence Licence Claw is licensed under the GNU Lesser General Public License (LGPL), version 2.1. Among other things, the license provides you a full access to the source code and allows you to use the library even if your program is not free. A copy of the license is included in the package. You can also access to its complete version through this link. \section main-contact Contact This library is developed by Julien Jorge. You can contact me at julien.jorge@gamned.org for any comment, question or request. */ libclaw-1.7.4/doc/doc-src/multi_type_map/000077500000000000000000000000001216507631600202765ustar00rootroot00000000000000libclaw-1.7.4/doc/doc-src/multi_type_map/multi_type_map.dox000066400000000000000000000162141216507631600240460ustar00rootroot00000000000000/*! \page multi_type_map Multi Type Map The multi type map is a map in which values of different types can be associated to the same key. - \ref mtm-why - \ref mtm-examples - \ref mtm-examples-declaration - \ref mtm-examples-visitor - \ref mtm-classes - \ref mtm-mtm - \ref mtm-visitor \section mtm-why Why this class In its original form, the goal of the claw::multi_type_map was to provide a simple and elegant solution to associate values of several types to keys in a map. This is a quite recurrent problem in programming. Indeed, a quick search on the Internet will result on questions like in this forum, or this other forum or eventually this last one. One solution for this problem would be to store the values in several maps, and deal with them according to the context. An other solution would be to use a single map and to impose to the values to inherit from a given class. Both solutions are tricky and painful. Hopefully, when using claw::multi_type_map you can obtain the same behavior without worrying. Plus, several functionalities are ready, such as exploring the whole set of pairs (key, value). \section mtm-examples Examples This section presents the creation and the exploration of a claw::multi_type_map. \subsection mtm-examples-declaration Declaring and using a multi_type_map The following program defines a \c multi_type_map where the values of type \c bool, \c float or \c std::string are associated to keys of type \c int. \code typedef claw::meta::type_list_maker::result my_type_list; typedef claw::multi_type_map map_type; map_type example_map; \endcode The first statement defines the list of the types of the values stored in the map. This list must end with claw::meta::no_type. Here, the claw::meta::type_list_maker type from the \ref claw::meta "metaprogramming package" with manage this for us. Then you can insert values in the map: \code example_map.set( 0, false ); example_map.set( 1, true ); example_map.set( 10, 3.14159 ); example_map.set( 30, 2.71828 ); example_map.set( 20, 1.61803 ); example_map.set( 100, "a string" ); example_map.set( 200, "an other string" ); \endcode You can also get the value associated with a given key for a given type: \code std::cout << example_map.get(1) << std::endl; \endcode Or even iterate on the pairs defined for a given type: \code for ( map_type::iterator::type it=example_map.begin(); it!=example_map.end(); ++it ) std::cout << it->first << '\t' << it->second << std::endl; \endcode \subsection mtm-examples-visitor Exploring the whole map Exploring the map for a given type is a convenient thing. An other convenient thing would be to iterate over the map for all the types at once. This is what the claw::multi_type_map_visitor is made for. First we have to define a function object that will receive the keys and the values. Our goal is to print the values in a stream, thus we define: \code struct map_printer { std::ostream& m_stream; map_printer( std::ostream& os ) : m_stream(os) { } template void operator()( int key, T value ) const { m_stream << "(" << key << ", " << value << ")" << std::endl; } }; \endcode Then, all we have to do is to pass an instance of this function object to a claw::multi_type_map_visitor: \code claw::multi_type_map_visitor visitor; visitor.run( example_map, map_printer(std::cout) ); \endcode The following output is obtained from this program: \verbatim (0, 0) (1, 1) (10, 3.14159) (20, 1.61803) (30, 2.71828) (100, a string) (200, an other string) \endverbatim \section mtm-classes Classes related to the multi type map This section presents the interfaces of the structures related to the claw::multi_type_map. \subsection mtm-mtm The claw::multi_type_map class The claw::multi_type_map class is defined as follows. For the sake of clarity, the end of the recursion on the inheritance is not described here. Instantiations of the claw::multi_type_map type must meet the following type requirements: - \a Key is comparable with operator<, - \a TypeList is a type instantiation of claw::meta::type_list, ending with claw::meta::no_type. \code template class multi_type_map: public multi_type_map { public: typedef Key key_type; typedef typename TypeList::head_type value_type; typedef multi_type_map self_type; typedef multi_type_map super; template struct iterator { /** \brief The type of the iterator. */ typedef implementation_defined type; /** \brief The type of the const_iterator. */ typedef typename implementation_defined const_type; }; public: template void erase( typename iterator::type it ); template std::size_t erase( const key_type& k ); template const ValueType& get( const key_type& k ) const; template ValueType& get( const key_type& k ); template void set( const key_type& k, const ValueType& v ); void set( const self_type& m ); template bool exists( const key_type& k ) const; std::size_t size() const; template typename iterator::type begin(); template typename iterator::type end(); template typename iterator::const_type begin() const; template typename iterator::const_type end() const; }; \endcode \subsection mtm-visitor claw::multi_type_map_visitor to explore a map The claw::multi_type_map_visitor is defined as follows. \code class multi_type_map_visitor { public: template void run( multi_type_map& m, Function f ) const; }; \endcode The type passed for the \a Function type argument of the claw::multi_type_map_visitor::run method must be a function object with an operator() similar to the following, where [text] means that text is optional. template [any_return_type] operator() (Key [const [&]], T [[const] &]) [const] In other words: - The function must be a template on the value of the second parameter. - The value returned by the call is ignored. - The first parameter will receive the key of the visited element, as a non modifiable value (whether a reference to a constant value or a copy of the value of the key), - The second parameter will receive the value of the visited element. Declaring the argument as a reference to a non constant T is allowed to modify the value in the map. Moreover, it is worth noting that any element can be inserted in the map during the visit and that removing the visited element from the map is allowed. */ libclaw-1.7.4/doc/doc-src/tween/000077500000000000000000000000001216507631600163705ustar00rootroot00000000000000libclaw-1.7.4/doc/doc-src/tween/tween.dox000066400000000000000000000512701216507631600202330ustar00rootroot00000000000000/*! \page tweeners C++ Tweeners Tween is a C++ library providing an implementation for tweening. In details, this library allows to interpolate the intermediate values between two given values during a time interval. This practice is well used in animation and is widely popular in the context of ActionScript/Flash games and websites. The goal of this library is to provide similar functionalities to C++ programs. - \ref tweener-why - \ref tweener-examples - \ref tweener-example-var - \ref tweener-example-group - \ref tweener-example-callback - \ref tweener-classes - \ref tweener-tweener-contract - \ref tweener-single_tweener - \ref tweener-tweener_group - \ref tweener-tweener_sequence - \ref tweener-easing-functions - \ref tweener-easing-contract - \ref tweener-easing-symmetric - \ref tweener-easing-predefined \section tweener-why Why this library Making a variable to vary from a original value to a final value following a predefined function is something recurrent in programming and especially during the development of games. As far as we know, the only free C++ library providing this functionality is cpptweener, a port of the tweener library. Unfortunately, even if cpptweener is an accurate port of the ActionScript tweener library, she lacks several functionalities. Our implementation is inspired from the aforementioned cpptweener and tweener libraries. Indeed, the same terminology will be used and the equations of Penners are also implemented. claw::tween provides the following functionalities: - Interpolation is done on the value of a given variable or using an user-provided callback function, - The interpolated values are computed using a predefined easing function or any user-provided function respecting the contract, - Several tweeners can easily be executed simultaneously or in a row, - The library has a modern C++ design. \section tweener-examples Examples This section presents some simple programs to show the usage of the claw::tween library. \subsection tweener-example-var Interpolating the value of a variable The following C++ program changes the value of a given variable from its initial value to a target value using a linear interpolation of the values in-between. \code #include #include #include int main() { double x(10); claw::tween::single_tweener t(x, 15, 1, claw::tween::easing_linear::ease_in); while ( !t.is_finished() ) { t.update(0.1); std::cout << x << std::endl; } return 0; } \endcode In the above function a variable \c x is created with an initial value. The tweener is then created: \code claw::tween::single_tweener t(x, 10, 1, claw::tween::easing_linear::ease_in); \endcode Since there is only a single value to interpolate, a \c single_tweener is used. Let's observe the detail of the constructor's parameters: \code single_tweener( double& val, double end, double duration, easing_function e ); \endcode The first parameter is the variable whose value is interpolated. The second parameter is the value that must be assigned to \a val at the end of the interpolation. Then the third parameter is the total duration of the interpolation. The unit can be whatever the user wants (seconds, milliseconds, …) as long as this is the same unit used for the updates. Finally, the fourth parameter is the function used to compute the intermediate values. See \ref tweener-easing-functions for details about those functions. The next part of the example updates the tweeners until the end value is reached. \code while ( !t.is_finished() ) { t.update(0.1); std::cout << x << std::endl; } \endcode The parameter of the \c update function is the elapsed time since the last update. Here the loop does ten iterations and produces the following output: \verbatim 10.5 11 11.5 12 12.5 13 13.5 14 14.5 15 \endverbatim \subsection tweener-example-group Interpolating the value of several variables The following C++ program changes the value of several variables from their initial values to a target value using a linear interpolation of the values in-between. Since we do not want to manage each tweener individually, we will use a \c tweener_group to manage them. \code #include #include #include #include struct coord { double x; double y; }; int main() { coord c = { 0, 0 }; claw::tween::tweener_group t; t.insert ( claw::tween::single_tweener ( c.x, 10, 1, claw::tween::easing_linear::ease_in ) ); t.insert ( claw::tween::single_tweener ( c.y, 10, 1, claw::tween::easing_linear::ease_in ) ); do { t.update(0.1); std::cout << c.x << ' ' << c.y << std::endl; } while ( !t.is_finished() ); return 0; } \endcode Here there are several values to interpolate simultaneously. Instead of updating each tweener individually, they are inserted into a \c tweener_group that will manage them. One can notice that claw::tween::tweener_group is also a tweener, thus we insert groups inside groups. \subsection tweener-example-callback Interpolating values using callbacks In the previous example all the member variables of \c coord are public, thus they can be passed by reference to the constructor of \c single_tweener. Unfortunately in most real-life situations the member variables are not public and those values are modified using setters. In this situation, one can use the second constructor of \c single_tweener: \code single_tweener ( double init, double end, double duration, update_function callback, easing_function e ); \endcode This constructor accept a callback function as the fourth parameter. This function, whose signature must be void (double), is called at each update with the interpolated value as its only parameter. Here is a modification of the previous example where setters are used to update the values of the \c coord. The callback is created using boost::bind to create a function with the adequate signature. \code #include #include #include #include #include class coord { public: double get_x() const { return m_x; } void set_x( double x ) { m_x = x; } double get_y() const { return m_y; } void set_y( double y ) { m_y = y; } private: double m_x; double m_y; }; int main() { coord c; claw::tween::tweener_group t; t.insert ( claw::tween::single_tweener ( 0, 10, 1, boost::bind( &coord::set_x, &c, _1 ), claw::tween::easing_linear::ease_in ) ); t.insert ( claw::tween::single_tweener ( 0, 10, 1, boost::bind( &coord::set_y, &c, _1 ), claw::tween::easing_linear::ease_in ) ); do { t.update(0.1); std::cout << c.get_x() << ' ' << c.get_y() << std::endl; } while ( !t.is_finished() ); return 0; } \endcode \section tweener-classes Tweener classes The library provides three tweener classes to manage tweeners, named \c single_tweener, \c tweener_group and \c tweener_sequence. Each one fills a particular need described in the following sections. \subsection tweener-tweener-contract The contract of the tweeners The tweener interface, as described below, is quite simple: \code class tweener { public: typedef boost::function finish_callback(); public: tweener(); tweener( const tweener& that ); tweener& operator=( const tweener& that ); void swap( tweener& that ) throw(); bool is_finished() const; double update( double dt ); void on_finished( finish_callback f ); }; \endcode The tweener library use two functions to manage the tweeners. First, the bool is_finished() const must return true if and only if the final value has been reached. Then, double update(double) is used to update the intermediate values, where the single argument is the amount of time since the last update or since the construction of the tweener. This function returns the amount of \a dt not used in the update. For example, if a tweener is at 1 time unit from the end of the interpolation and update(1.5) is called on this tweener, then 0.5 is returned. Indeed, only 1 of the 1.5 available units have been used to reach the end of the interpolation. When a tweener is finished, all the functions passed to void on_finished( finish_callback ) are called in sequence. \subsection tweener-single_tweener claw::tween::single_tweener The claw::tween::single_tweener object is the class to use to make one value to vary from a source value to a final value in a given amount of time and according to a given easing function. The interface is described below: \code class single_tweener { public: typedef boost::function update_function; typedef boost::function easing_function; public: single_tweener(); single_tweener ( double init, double end, double duration, update_function callback, easing_function e ); single_tweener ( double& val, double end, double duration, easing_function e ); void set_init( double v ); void set_end( double v ); void set_duration( double v ); void set_callback( update_function f ); void set_easing( easing_function f ); bool is_finished() const; double update( double dt ); void on_finished( finish_callback f ); }; \endcode The default behavior of the single_tweener is to use a callback function to send the new value to the caller at each update. Let's have a look at the following constructor. \code single_tweener ( double init, double end, double duration, update_function callback, easing_function e ); \endcode The two first arguments defined the value returned by the tweener respectively at the beginning and the end of the interpolation. The third parameter is the total duration of the interpolation. The unit can be whatever the user wants (seconds, milliseconds, …) as long as this is the same unit used for the updates. The fourth argument is the callback function called at each update. His signature must be void (double), where the argument receive the current intermediate value. Finally, the fifth parameter is the function used to compute the intermediate values. See \ref tweener-easing-functions for details about this topic. In the situation where the interpolation is done on a known variable, one would have to provide a callback function to assign the intermediate values to the variable. In order to ease the use of tweeners for this kind of situation, an other constructor is defined: \code single_tweener( double& val, double end, double duration, easing_function e ); \endcode The difference with the aforementioned constructor is that there is no callback function to provide. Here, the first parameter is the variable whose value is interpolated. Its initial value is taken for the initial value of the interpolation. The created tweener will manage the assignment of the intermediate value to \a val. In other words, the following program: \code double v; void assign_v( double i ) { v = i; } single_tweener create_tweener() { return single_tweener(0, 10, 1, &assign_v, easing_linear::ease_in); } \endcode is completely equivalent to this more concise program: \code double v(0); single_tweener create_tweener() { return single_tweener(v, 10, 1, easing_linear::ease_in); } \endcode The void on_finished() function allows to insert a callback that will be called when the tweener finishes, during a call to double update(double). \subsection tweener-tweener_group claw::tween::tweener_group Once that single_tweener is understood, the other tweener classes are quite simple. The claw::tween::tweener_group class is a tweener class that executes several tweeners simultaneously. Its interface is defined as follows: \code class tweener_group: { public: void insert( const tweener& t ); void clear(); bool is_finished() const; double update( double dt ); void on_finished( finish_callback f ); }; \endcode The \c tweener_group class does not compute values by itself but forwards the call to update(double) to other tweeners, thus allowing to play several tweeners in parallel. The bool is_finished() function returns true when all the tweeners of the group are finished. Also, tweeners can be inserted in a \c tweener_group at any time. The void on_finished() function allows to insert a callback that will be called when the last tweener in the group finishes, during a call to double update(double). \subsection tweener-tweener_sequence claw::tween::tweener_sequence The claw::tween::tweener_sequence class is a tweener class that executes several tweeners in a row. Its interface is defined as follows: \code class tweener_sequence: { public: void insert( const tweener& t ); void clear(); bool is_finished() const; double update( double dt ); void on_finished( finish_callback f ); }; \endcode The \c tweener_sequence class does not compute values by itself but forwards the call to update(double) to the current active tweener, splitting the argument value among several tweeners if needed. The bool is_finished() function returns true when all the tweeners of the sequence are finished. Also, tweeners can be inserted in a \c tweener_sequence at any time. The void on_finished() function allows to insert a callback that will be called when the last tweener in the sequence finishes, during a call to double update(double). \section tweener-easing-functions Easing functions The easing functions define how the intermediate values are computed during the interpolation. For example, when tweening a value from 0 to 1 during 1 second using a linear interpolation, the value at 0.5 second must be 0.5. But when using a quadratic interpolation the value at this same date must be 0.25. The goal of an easing function is to compute those intermediate values according to a predefined curve. \subsection tweener-easing-contract The contract of the easing functions An easing function is a function whose signature is double (double) verifing the following contract: - The argument is a number in (0,1) representing the ratio of the total time for which we want the value. - The return value is the amount of change at the time given by the argument, relatively to the interval of the interpolated values, without restriction on its range. The second criteria may need more explainations. For example, if the tweener's start value is \a v1 and its last value is \a v2. Then a return value of 0 means that the intermediate value set by the tweener must be \a v1, while a return value equal to 1 corresponds to an intermediate value equal to \a v2. In other words, a return value of \a x implies an intermediate value set by the tweener to v1 + x × (v2 - v1). \subsection tweener-easing-symmetric claw::tween::symmetric_easing There are typically three ways to apply an easing effect: when reaching the final value (ease-in), when leaving the initial value (ease-out), or in both situations (ease-in-out). One can observe that the ease-out can be computed from the ease-in value, and ease-in-out can be computed from ease-in and ease-out. The goal of the claw::tween::symmetric_easing class is to define the ease-out and ease-in-out functions given the ease-out-function. This class is defined as: \code template class symmetric_easing { public: static double ease_in( double t ); static double ease_out( double t ); static double ease_in_out( double t ); }; \endcode Given a function double f(double) verifying the easing contract, then symmetric_easing provides the following implementations: - symmetric_easing::ease_in(t) returns f(t), - symmetric_easing::ease_out(t) returns 1 - ease_in(1 - t), - symmetric_easing::ease_in_out(t) returns ease_in(2 * t) á 2 if \a t is less than 0.5, 0.5 + ease_out(2 * t - 1) á 2 otherwise. \subsection tweener-easing-predefined Predefined easing functions The following easing classes are implementations of the \c symmetric_easing class in the library.
Easing Class and Ease-In Equation Ease-In Ease-Out Ease-In-Out
claw::tween::easing_back f(t) = t² × (2.70158 × t − 1.70158) \image html tween/back-in.png \image html tween/back-out.png \image html tween/back-inout.png
claw::tween::easing_bounce
f(t) = 1 − 7.5625 × (1-t)² if 1 − t < 1 ÷ 2.75 or 1 − (7.5625 × (1 − t − 1.5 ÷ 2.75)² + 0.75) if 1 − t < 2 ÷ 2.75 or 1 − (7.5625 × (1 − t − 2.25 ÷ 2.75)² + 0.9375) if 1 − t < 2.5 ÷ 2.75 1 − (7.5625 × (1 − t − 2.625 / 2.75)² + 0.984375) otherwise
\image html tween/bounce-in.png \image html tween/bounce-out.png \image html tween/bounce-inout.png
claw::tween::easing_circ f(t) = 1 − √(1 − t²) \image html tween/circ-in.png \image html tween/circ-out.png \image html tween/circ-inout.png
claw::tween::easing_cubic f(t) = tÂł \image html tween/cubic-in.png \image html tween/cubic-out.png \image html tween/cubic-inout.png
claw::tween::easing_elastic f(t) = −210 × (t − 1) × sin(((t − 1) − 0.3 ÷ 4) × 2 × π ÷ 4) \image html tween/elastic-in.png \image html tween/elastic-out.png \image html tween/elastic-inout.png
claw::tween::easing_expo
f(t) = 0 if t = 0 210 × (t − 1)
\image html tween/expo-in.png \image html tween/expo-out.png \image html tween/expo-inout.png
claw::tween::easing_linear f(t) = t \image html tween/linear-in.png \image html tween/linear-out.png \image html tween/linear-inout.png
claw::tween::easing_none f(t) = 0 \image html tween/none-in.png \image html tween/none-out.png \image html tween/none-inout.png
claw::tween::easing_quad f(t) = t² \image html tween/quad-in.png \image html tween/quad-out.png \image html tween/quad-inout.png
claw::tween::easing_quart f(t) = t⁴ \image html tween/quart-in.png \image html tween/quart-out.png \image html tween/quart-inout.png
claw::tween::easing_quint f(t) = t⁾ \image html tween/quint-in.png \image html tween/quint-out.png \image html tween/quint-inout.png
claw::tween::easing_sine f(t) = 1 − cos(t × π ÷ 2) \image html tween/sine-in.png \image html tween/sine-out.png \image html tween/sine-inout.png
*/ libclaw-1.7.4/doc/man/000077500000000000000000000000001216507631600144675ustar00rootroot00000000000000libclaw-1.7.4/doc/man/claw-config.man.sgml000066400000000000000000000123371216507631600203240ustar00rootroot00000000000000 manpage.1'. You may view the manual page with: `docbook-to-man manpage.sgml | nroff -man | less'. A typical entry in a Makefile or Makefile.am is: manpage.1: manpage.sgml docbook-to-man $< > $@ The docbook-to-man binary is found in the docbook-to-man package. Please remember that if you create the nroff version in one of the debian/rules file targets (such as build), you will need to include docbook-to-man in your Build-Depends control field. --> Julien"> Jorge"> 2008-05-17"> 1"> julien_jorge@yahoo.fr"> CLAW-CONFIG"> Debian"> GNU"> ]>
&dhemail;
&dhfirstname; &dhsurname; 2006 &dhusername; &dhdate;
&dhucpackage; &dhsection; &dhpackage; show information about installed libclaw libraries &dhpackage; DESCRIPTION This manual page documents briefly the &dhpackage; command, &dhpackage; is a program that shows information about the installed libclaw libraries. OPTIONS The following options are supported: The library for which the informations are displayed. Show the prefix libclaw was built with. The prefix may be overridden by passing the argument PREFIX. Show the executable prefix libclaw was built with. The executable prefix may be overridden by passing the argument EPREFIX. Show the version of the installed libclaw. Show the compiler flags for linking to the installed library. Show the compiler flags for compiling against the installed library. EXAMPLE Display the libraries to link to in order to use the claw_graphic library. claw-config graphic --libs Display the compiler flags required to use all the libraries of libclaw. claw-config all --cflags AUTHOR This manual page was written by &dhusername; &dhemail; for the &debian; system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts.
libclaw-1.7.4/examples/000077500000000000000000000000001216507631600147655ustar00rootroot00000000000000libclaw-1.7.4/examples/CMakeLists.txt000066400000000000000000000004501216507631600175240ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.8) project(claw-examples) subdirs( application automaton avl compress config_file curve dynamic_library graph game_ai image iterator kmp memory multi_type_map ordered_set singleton sockets string_algorithm system trie ) libclaw-1.7.4/examples/application/000077500000000000000000000000001216507631600172705ustar00rootroot00000000000000libclaw-1.7.4/examples/application/CMakeLists.txt000066400000000000000000000015311216507631600220300ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-application-example) # check profiling mode if( CMAKE_BUILD_TYPE MATCHES profile ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -pg" ) endif( CMAKE_BUILD_TYPE MATCHES profile ) # check DEBUG mode if( CMAKE_BUILD_TYPE MATCHES debug ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DEBUG" ) endif( CMAKE_BUILD_TYPE MATCHES debug ) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) #------------------------------------------------------------------------------- # look for libraries find_package(libclaw) add_definitions( ${CLAW_DEFINITIONS} ) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) link_directories( ${CLAW_LINK_DIRECTORY} ) add_executable( ex-application main.cpp ) target_link_libraries( ex-application ${CLAW_APPLICATION_LIBRARIES} ) libclaw-1.7.4/examples/application/README000066400000000000000000000003451216507631600201520ustar00rootroot00000000000000program_name: ex-application This example program shows how to use the claw::application and the claw::logger classes. There is other example programs that use the claw::application class and the command line arguments system. libclaw-1.7.4/examples/application/main.cpp000066400000000000000000000041451216507631600207240ustar00rootroot00000000000000/** * \file main.cpp * \brief This program show a basic use of the claw::application class. * \author Julien Jorgex */ #include #include #include /** * \brief This class represents the application. */ class my_app : public claw::application { public: my_app( int& argc, char** &argv ); int run(); }; // class my_app /*----------------------------------------------------------------------------*/ /** * \brief Constructor. Parse the command line and initialize the application. */ my_app::my_app( int& argc, char** &argv ) : claw::application(argc, argv) { m_arguments.add_short("-b", "Sample boolean argument.", true); m_arguments.add_long("--string", "Print a string.", true, "any_string"); m_arguments.add("-h", "--help", "Print this help screen.", true); m_arguments.parse(argc, argv); if ( m_arguments.get_bool("-h") ) m_arguments.help( "more_string..." ); std::cout << "Testing error_level:" << std::endl; claw::logger << claw::log_error << "error_level:program_name == " << m_arguments.get_program_name() << claw::lendl; std::cout << "Testing warning_level:" << std::endl; for (int i=0; i #include #include #include #include #include /*----------------------------------------------------------------------------*/ /** * \brief Print an automation. * \param os The stream to write in. * \param a The automaton to print. * \return os. */ template std::ostream& print_automaton( std::ostream& os, const Automaton& a ) { typedef typename Automaton::state_type state_type; typedef typename Automaton::edge_type edge_type; std::vector states; std::vector alphabet; typename std::vector::const_iterator it_s; typename std::vector::const_iterator it_a; /* Print the alphabet. */ a.alphabet( alphabet ); if ( alphabet.empty() ) os << "A = {}" << std::endl; else { it_a = alphabet.begin(); os << "A = { " << *it_a; ++it_a; for (; it_a != alphabet.end(); ++it_a) os << ", " << *it_a; os << " }" << std::endl; } /* Print initial states. */ a.initial_states( states ); if ( states.empty() ) os << "I = {}" << std::endl; else { it_s = states.begin(); os << "I = { " << *it_s; ++it_s; for (; it_s != states.end(); ++it_s) os << ", " << *it_s; os << " }" << std::endl; } /* Print final states. */ a.final_states( states ); if ( states.empty() ) os << "F = {}" << std::endl; else { it_s = states.begin(); os << "F = { " << *it_s; ++it_s; for (; it_s != states.end(); ++it_s) os << ", " << *it_s; os << " }" << std::endl; } /* Print states and edges. */ a.states( states ); if ( states.empty() ) { os << "E = {}" << std::endl; os << "T = {}" << std::endl; } else { std::vector transitions; typename std::vector::const_iterator it_v; /* states */ it_s = states.begin(); os << "E = { " << *it_s; ++it_s; for(; it_s != states.end(); ++it_s) os << ", " << *it_s; os << " }" << std::endl; /* edges */ os << "T = {" << std::endl; for(it_s = states.begin(); it_s != states.end(); ++it_s) { os << *it_s << " -> { "; for (it_v = states.begin(); it_v != states.end(); ++it_v) { a.edges( *it_s, *it_v, transitions ); for (it_a = transitions.begin(); it_a!=transitions.end(); ++it_a) os << "(" << *it_v << ", " << *it_a << ") "; } os << "}" << std::endl; } os << "}" << std::endl; } return os; } // print_automaton() /*----------------------------------------------------------------------------*/ /** * \brief Read a line describing a part of an automaton. * \param is The stream in which we read the attributes. * \param a The automaton in which we add the result of the line. * * The following actions can be done by this function: * add an edge: * E * * add a state: * S * * add an initial state: * I * * add a final state: * F * * Other lines are ignored. */ template void read_line( std::istream& is, Automaton& a ) { typename Automaton::state_type src, target; typename Automaton::edge_type edge; char line_type; if ( is >> line_type ) switch ( line_type ) { case 'E': { is >> src >> target >> edge; a.add_edge( src, target, edge ); break; } case 'S': { is >> src; a.add_state( src ); break; } case 'I': { is >> src; a.add_initial_state( src ); break; } case 'F': { is >> src; a.add_final_state( src ); break; } } } // read_line() /*----------------------------------------------------------------------------*/ /** * \brief Load an automation from a file. * \param is The stream describing the automaton. * \param a (out) The read automaton. */ template void load_automaton( std::istream& is, Automaton& a ) { std::string line; while ( std::getline(is, line) ) { std::istringstream iss(line); read_line( iss, a ); } } // load_automaton() /*----------------------------------------------------------------------------*/ /** * \brief Tell if a pattern is recognized by an automaton. * \param pattern The pattern to check. * \param a The automaton. */ bool valid_pattern ( const std::string& pattern, const claw::automaton& a ) { return a.match( pattern.begin(), pattern.end() ); } // valid_pattern() /*----------------------------------------------------------------------------*/ int main( int argc, char* argv[] ) { if (argc < 3) std::cerr << "usage:\n" << argv[0] << " automaton_file pattern..." << std::endl; else { std::ifstream f( argv[1] ); if ( !f ) std::cerr << "Can't open file '" << argv[1] << "'" << std::endl; else { claw::automaton a; load_automaton( f, a ); print_automaton(std::cout, a) << std::endl; for (int i=2; i!=argc; ++i) if ( valid_pattern( argv[i], a ) ) std::cout << argv[i] << ": valid" << std::endl; else std::cout << argv[i] << ": not valid" << std::endl; } } return 0; } libclaw-1.7.4/examples/automaton/test_files/000077500000000000000000000000001216507631600211355ustar00rootroot00000000000000libclaw-1.7.4/examples/automaton/test_files/automaton_file/000077500000000000000000000000001216507631600241435ustar00rootroot00000000000000libclaw-1.7.4/examples/automaton/test_files/automaton_file/ab.txt000066400000000000000000000002031216507631600252610ustar00rootroot00000000000000# this automaton recognizes strings composed of a succession of 'ab' # like 'ab' or 'ababab'... # E 1 2 a E 2 3 b E 3 2 a I 1 F 3 libclaw-1.7.4/examples/automaton/test_files/automaton_file/inc_numbers.txt000066400000000000000000000020151216507631600272060ustar00rootroot00000000000000# this automaton recognizes numbers in which the numbers 0-9 can be # found in increasing order. # # Examples: # # 0123456789 is valid # 01243456789 is valid # 0143456789 is not valid # 1234567890 is not valid # E 0 1 0 E 0 0 1 E 0 0 2 E 0 0 3 E 0 0 4 E 0 0 5 E 0 0 6 E 0 0 7 E 0 0 8 E 0 0 9 E 1 1 0 E 1 2 1 E 1 1 2 E 1 1 3 E 1 1 4 E 1 1 5 E 1 1 6 E 1 1 7 E 1 1 8 E 1 1 9 E 2 2 0 E 2 2 1 E 2 3 2 E 2 2 3 E 2 2 4 E 2 2 5 E 2 2 6 E 2 2 7 E 2 2 8 E 2 2 9 E 3 3 0 E 3 3 1 E 3 3 2 E 3 4 3 E 3 3 4 E 3 3 5 E 3 3 6 E 3 3 7 E 3 3 8 E 3 3 9 E 4 4 0 E 4 4 1 E 4 4 2 E 4 4 3 E 4 5 4 E 4 4 5 E 4 4 6 E 4 4 7 E 4 4 8 E 4 4 9 E 5 5 0 E 5 5 1 E 5 5 2 E 5 5 3 E 5 5 4 E 5 6 5 E 5 5 6 E 5 5 7 E 5 5 8 E 5 5 9 E 6 6 0 E 6 6 1 E 6 6 2 E 6 6 3 E 6 6 4 E 6 6 5 E 6 7 6 E 6 6 7 E 6 6 8 E 6 6 9 E 7 7 0 E 7 7 1 E 7 7 2 E 7 7 3 E 7 7 4 E 7 7 5 E 7 7 6 E 7 8 7 E 7 7 8 E 7 7 9 E 8 8 0 E 8 8 1 E 8 8 2 E 8 8 3 E 8 8 4 E 8 8 5 E 8 8 6 E 8 8 7 E 8 9 8 E 8 8 9 E 9 9 0 E 9 9 1 E 9 9 2 E 9 9 3 E 9 9 4 E 9 9 5 E 9 9 6 E 9 9 7 E 9 9 8 E 9 10 9 I 0 F 10 libclaw-1.7.4/examples/automaton/test_files/automaton_file/numbers.txt000066400000000000000000000026151216507631600263630ustar00rootroot00000000000000# this automaton recognizes real numbers: # # [+-]?[0-9]*(.[0-9]*)?[0-9]([eE][+-]?[0-9]+)? # # The automaton is not determinist and has several initial states and # final states. # # Examples: # # .24 is valid # 02.8921 is valid # 2 is valid # 3. is not valid # .24e32 is valid # .42E421 is valid # .32e+24 is valid # .98E-0 is valid # +87 is valid # 10fere is not valid # E 0 1 + E 0 1 - E 1 1 0 E 1 1 1 E 1 1 2 E 1 1 3 E 1 1 4 E 1 1 5 E 1 1 6 E 1 1 7 E 1 1 8 E 1 1 9 E 1 2 . E 2 2 0 E 2 2 1 E 2 2 2 E 2 2 3 E 2 2 4 E 2 2 5 E 2 2 6 E 2 2 7 E 2 2 8 E 2 2 9 E 2 3 0 E 2 3 1 E 2 3 2 E 2 3 3 E 2 3 4 E 2 3 5 E 2 3 6 E 2 3 7 E 2 3 8 E 2 3 9 E 1 4 0 E 1 4 1 E 1 4 2 E 1 4 3 E 1 4 4 E 1 4 5 E 1 4 6 E 1 4 7 E 1 4 8 E 1 4 9 E 3 5 e E 3 5 e E 3 5 e E 3 5 e E 3 5 e E 3 5 e E 3 5 e E 3 5 e E 3 5 e E 3 5 e E 3 5 E E 3 5 E E 3 5 E E 3 5 E E 3 5 E E 3 5 E E 3 5 E E 3 5 E E 3 5 E E 3 5 E E 4 5 e E 4 5 e E 4 5 e E 4 5 e E 4 5 e E 4 5 e E 4 5 e E 4 5 e E 4 5 e E 4 5 e E 4 5 E E 4 5 E E 4 5 E E 4 5 E E 4 5 E E 4 5 E E 4 5 E E 4 5 E E 4 5 E E 4 5 E E 5 6 + E 5 6 - E 5 5 0 E 5 5 1 E 5 5 2 E 5 5 3 E 5 5 4 E 5 5 5 E 5 5 6 E 5 5 7 E 5 5 8 E 5 5 9 E 5 7 0 E 5 7 1 E 5 7 2 E 5 7 3 E 5 7 4 E 5 7 5 E 5 7 6 E 5 7 7 E 5 7 8 E 5 7 9 E 6 6 0 E 6 6 1 E 6 6 2 E 6 6 3 E 6 6 4 E 6 6 5 E 6 6 6 E 6 6 7 E 6 6 8 E 6 6 9 E 6 7 0 E 6 7 1 E 6 7 2 E 6 7 3 E 6 7 4 E 6 7 5 E 6 7 6 E 6 7 7 E 6 7 8 E 6 7 9 I 0 I 1 F 3 F 4 F 7 libclaw-1.7.4/examples/automaton/test_files/expected/000077500000000000000000000000001216507631600227365ustar00rootroot00000000000000libclaw-1.7.4/examples/automaton/test_files/expected/test_ab.out000066400000000000000000000003341216507631600251100ustar00rootroot00000000000000A = { a, b } I = { 1 } F = { 3 } E = { 1, 2, 3 } T = { 1 -> { (2, a) } 2 -> { (3, b) } 3 -> { (2, a) } } ababababababa: not valid ababab: valid bababa: not valid bababab: not valid a: not valid b: not valid : not valid libclaw-1.7.4/examples/automaton/test_files/expected/test_inc_numbers.out000066400000000000000000000017361216507631600270410ustar00rootroot00000000000000A = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } I = { 0 } F = { 10 } E = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } T = { 0 -> { (0, 1) (0, 2) (0, 3) (0, 4) (0, 5) (0, 6) (0, 7) (0, 8) (0, 9) (1, 0) } 1 -> { (1, 0) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, 7) (1, 8) (1, 9) (2, 1) } 2 -> { (2, 0) (2, 1) (2, 3) (2, 4) (2, 5) (2, 6) (2, 7) (2, 8) (2, 9) (3, 2) } 3 -> { (3, 0) (3, 1) (3, 2) (3, 4) (3, 5) (3, 6) (3, 7) (3, 8) (3, 9) (4, 3) } 4 -> { (4, 0) (4, 1) (4, 2) (4, 3) (4, 5) (4, 6) (4, 7) (4, 8) (4, 9) (5, 4) } 5 -> { (5, 0) (5, 1) (5, 2) (5, 3) (5, 4) (5, 6) (5, 7) (5, 8) (5, 9) (6, 5) } 6 -> { (6, 0) (6, 1) (6, 2) (6, 3) (6, 4) (6, 5) (6, 7) (6, 8) (6, 9) (7, 6) } 7 -> { (7, 0) (7, 1) (7, 2) (7, 3) (7, 4) (7, 5) (7, 6) (7, 8) (7, 9) (8, 7) } 8 -> { (8, 0) (8, 1) (8, 2) (8, 3) (8, 4) (8, 5) (8, 6) (8, 7) (8, 9) (9, 8) } 9 -> { (9, 0) (9, 1) (9, 2) (9, 3) (9, 4) (9, 5) (9, 6) (9, 7) (9, 8) (10, 9) } 10 -> { } } 0123456789: valid 01243456789: valid 0143456789: not valid 1234567890: not valid libclaw-1.7.4/examples/automaton/test_files/expected/test_numbers.out000066400000000000000000000040121216507631600261760ustar00rootroot00000000000000A = { +, -, ., 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, E, e } I = { 0, 1 } F = { 3, 4, 7 } E = { 0, 1, 2, 3, 4, 5, 6, 7 } T = { 0 -> { (1, +) (1, -) } 1 -> { (1, 0) (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, 7) (1, 8) (1, 9) (2, .) (4, 0) (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, 7) (4, 8) (4, 9) } 2 -> { (2, 0) (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, 7) (2, 8) (2, 9) (3, 0) (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, 7) (3, 8) (3, 9) } 3 -> { (5, E) (5, E) (5, E) (5, E) (5, E) (5, E) (5, E) (5, E) (5, E) (5, E) (5, e) (5, e) (5, e) (5, e) (5, e) (5, e) (5, e) (5, e) (5, e) (5, e) } 4 -> { (5, E) (5, E) (5, E) (5, E) (5, E) (5, E) (5, E) (5, E) (5, E) (5, E) (5, e) (5, e) (5, e) (5, e) (5, e) (5, e) (5, e) (5, e) (5, e) (5, e) } 5 -> { (5, 0) (5, 1) (5, 2) (5, 3) (5, 4) (5, 5) (5, 6) (5, 7) (5, 8) (5, 9) (6, +) (6, -) (7, 0) (7, 1) (7, 2) (7, 3) (7, 4) (7, 5) (7, 6) (7, 7) (7, 8) (7, 9) } 6 -> { (6, 0) (6, 1) (6, 2) (6, 3) (6, 4) (6, 5) (6, 6) (6, 7) (6, 8) (6, 9) (7, 0) (7, 1) (7, 2) (7, 3) (7, 4) (7, 5) (7, 6) (7, 7) (7, 8) (7, 9) } 7 -> { } } 238: valid +1289: valid -102: valid .24: valid +.8921: valid -.0398: valid 239.23: valid +2323.19208: valid -092.23: valid .24e12: valid +.8921e12098: valid -.0398e8372: valid 239.23e12: valid +2323.19208e1280: valid -092.23e12890: valid .24E12: valid +.8921E12098: valid -.0398E8372: valid 239.23E12: valid +2323.19208E1280: valid -092.23E12890: valid .24e+12: valid +.8921e+12098: valid -.0398e+8372: valid 239.23e+12: valid +2323.19208e+1280: valid -092.23e+12890: valid .24E+12: valid +.8921E+12098: valid -.0398E+8372: valid 239.23E+12: valid +2323.19208E+1280: valid -092.23E+12890: valid .24e-12: valid +.8921e-12098: valid -.0398e-8372: valid 239.23e-12: valid +2323.19208e-1280: valid -092.23e-12890: valid .24E-12: valid +.8921E-12098: valid -.0398E-8372: valid 239.23E-12: valid +2323.19208E-1280: valid -092.23E-12890: valid 212.: not valid 3.232e: not valid 3.24E: not valid +42.: not valid -421.: not valid .32e+: not valid .98E-: not valid +87.e: not valid 10fere: not valid libclaw-1.7.4/examples/automaton/test_files/scripts/000077500000000000000000000000001216507631600226245ustar00rootroot00000000000000libclaw-1.7.4/examples/automaton/test_files/scripts/test_ab.sh000066400000000000000000000001501216507631600245750ustar00rootroot00000000000000#!/bin/sh ./ex-automaton "test_files/automaton_file/ab.txt" ababababababa ababab bababa bababab a b "" libclaw-1.7.4/examples/automaton/test_files/scripts/test_inc_numbers.sh000066400000000000000000000001631216507631600265230ustar00rootroot00000000000000#!/bin/sh ./ex-automaton ./test_files/automaton_file/inc_numbers.txt 0123456789 01243456789 0143456789 1234567890 libclaw-1.7.4/examples/automaton/test_files/scripts/test_numbers.sh000066400000000000000000000013401216507631600256700ustar00rootroot00000000000000#!/bin/sh ./ex-automaton test_files/automaton_file/numbers.txt \ 238 +1289 -102 \ .24 +.8921 -.0398 \ 239.23 +2323.19208 -092.23 \ .24e12 +.8921e12098 -.0398e8372 \ 239.23e12 +2323.19208e1280 -092.23e12890 \ .24E12 +.8921E12098 -.0398E8372 \ 239.23E12 +2323.19208E1280 -092.23E12890 \ .24e+12 +.8921e+12098 -.0398e+8372 \ 239.23e+12 +2323.19208e+1280 -092.23e+12890 \ .24E+12 +.8921E+12098 -.0398E+8372 \ 239.23E+12 +2323.19208E+1280 -092.23E+12890 \ .24e-12 +.8921e-12098 -.0398e-8372 \ 239.23e-12 +2323.19208e-1280 -092.23e-12890 \ .24E-12 +.8921E-12098 -.0398E-8372 \ 239.23E-12 +2323.19208E-1280 -092.23E-12890 \ 212. 3.232e 3.24E +42. -421. .32e+ .98E- +87.e 10fere libclaw-1.7.4/examples/avl/000077500000000000000000000000001216507631600155475ustar00rootroot00000000000000libclaw-1.7.4/examples/avl/CMakeLists.txt000066400000000000000000000005141216507631600203070ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-avl-example) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) find_package(libclaw) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) add_definitions( ${CLAW_DEFINITIONS} ) add_executable( ex-avl main.cpp ) add_executable( ex-vs std_vs_claw.cpp ) libclaw-1.7.4/examples/avl/README000066400000000000000000000004401216507631600164250ustar00rootroot00000000000000program_name: ex-avl This example program shows basic use of the claw::avl class. The program takes a file as argument. Some operations are then done to test the methods of the class. This program is a draft. It should be re-written to be sure that all methods of the class are tested. libclaw-1.7.4/examples/avl/main.cpp000066400000000000000000000122711216507631600172020ustar00rootroot00000000000000/** * \file main.cpp * \brief Example program to show the use of the the claw::avl class. * * The program take avl values from a file and do some operations. * * \author Julien Jorge */ #include #include #include /** * \brief This class allows us to test the claw::avl class with a non- type. */ class some_class { public: int value; public: bool operator==(const some_class& that) const { return value == that.value; } bool operator<(const some_class& that) const { return value < that.value; } friend std::ostream& operator<<(std::ostream& os, const some_class& o) { return os << o.value; } }; // class some_class void instanciate_methods( const claw::avl& tree ) { claw::avl cpy(tree.begin(), tree.end()); std::cout << (tree == cpy) << std::endl; std::cout << (tree != cpy) << std::endl; std::cout << (tree <= cpy) << std::endl; std::cout << (tree >= cpy) << std::endl; std::cout << (tree < cpy) << std::endl; std::cout << (tree > cpy) << std::endl; claw::avl::const_iterator it; for (it=tree.begin(); it!=tree.end(); ++it) std::cout << *it << ' '; std::cout << std::endl; for (it=cpy.begin(); it!=cpy.end(); ++it) std::cout << *it << ' '; std::cout << std::endl; it = tree.find_nearest_greater( *tree.lower_bound() ); std::cout << *it << std::endl; it = tree.find_nearest_lower( *tree.upper_bound() ); std::cout << *it << std::endl; cpy.insert( tree.begin(), tree.end() ); } // instanciate_methods() int main( int argc, char* argv[] ) { if (argc != 2) { std::cout << argv[0] << " test_file" << std::endl; return 1; } else { claw::avl tree; claw::avl::const_iterator it; std::ifstream f( argv[1] ); if (!f) { std::cerr << "Can't open file " << argv[1] << std::endl; return 1; } else { int i,j; some_class o; if ( tree.empty() ) std::cout << "Tree is empty" << std::endl; else std::cout << "Tree is not empty but should !" << std::endl; std::cout << "File loading..." << std::endl; while ( f >> o.value ) tree.insert( o ); f.close(); std::cout << "size : " << tree.size() << std::endl; instanciate_methods(tree); it = tree.lower_bound(); if ( it != tree.end() ) std::cout << "Min = " << *it << std::endl; it = tree.upper_bound(); if ( it != tree.end() ) std::cout << "Max = " << *it << std::endl; if ( tree.empty() ) std::cout << "Tree is empty but shouldn't !" << std::endl; else std::cout << "Tree's not empty" << std::endl; std::cout << "Found :"; for( o.value=0; o.value!=100; ++o.value ) if ( tree.find(o) != tree.end() ) std::cout << " " << o; std::cout << std::endl;; std::cout << "Scan with an iterator :"; for (it = tree.begin(); it != tree.end(); ++it ) std::cout << " " << *it; std::cout<< std::endl; std::cout << "Scan bis, iterator affectation :"; for (it = tree.begin(); it != tree.end(); ++it ) { claw::avl::const_iterator it_bis = it; std::cout << *it << ":"; for (; it_bis != tree.end(); ++it_bis ) std::cout << " " << *it_bis; std::cout<< std::endl; } std::cout << "Deletions" << std::endl; // Try to be a few random for( i=0; i!=10; ++i ) for ( j=0; j!=100; ++j ) { o.value = i + j*10; tree.erase(o); } std::cout << "Copy and scan" << std::endl; std::cout << "source size : " << tree.size() << std::endl; claw::avl avl_2(tree); std::cout << "copy size : " << tree.size() << std::endl; if ( tree.empty() ) std::cout << "Tree's copy is empty" << std::endl; else std::cout << "Tree's copy is not empty" << std::endl; for (it = avl_2.begin(); it != avl_2.end(); ++it ) std::cout << " " << *it; std::cout << std::endl; std::cout << "Reverse scan" << std::endl; it = avl_2.end(); while( it != avl_2.begin() ) { --it; std::cout << " " << *it; } std::cout << std::endl; std::cout << "Assignment" << std::endl; avl_2 = tree; std::cout << "Clear" << std::endl; avl_2.clear(); if ( avl_2.empty() ) std::cout << "Tree's is empty" << std::endl; else std::cout << "Tree's is not empty but should !" << std::endl; return 0; } } } libclaw-1.7.4/examples/avl/std_vs_claw.cpp000066400000000000000000000114651216507631600205720ustar00rootroot00000000000000/** * \file main.cpp * \brief Example program to show the use of the the claw::avl class. * * The program take avl values from a file and do some operations. * * \author Julien Jorge */ #include #include #include #include #include #include #include #include /*----------------------------------------------------------------------------*/ template unsigned int time_insert( SetType& s, std::vector data ) { timeval beg, end; const unsigned int n = data.size(); s.clear(); gettimeofday(&beg, NULL); for (unsigned int i=0; i!=n; ++i) s.insert(data[i]); gettimeofday(&end, NULL); SetType c(s); return ( (end.tv_sec * 1000000 + end.tv_usec) - (beg.tv_sec * 1000000 + beg.tv_usec) ) / 1000; } // time_insert() /*----------------------------------------------------------------------------*/ template unsigned int time_insert_it( SetType& s, std::vector data ) { timeval beg, end; s.clear(); gettimeofday(&beg, NULL); s.insert(data.begin(), data.end()); gettimeofday(&end, NULL); return ( (end.tv_sec * 1000000 + end.tv_usec) - (beg.tv_sec * 1000000 + beg.tv_usec) ) / 1000; } // time_insert_it() /*----------------------------------------------------------------------------*/ template unsigned int time_iterator( SetType& s ) { timeval beg, end; unsigned int v(0); gettimeofday(&beg, NULL); typename SetType::const_iterator it; const typename SetType::const_iterator eit = s.end(); for (it=s.begin(); it!=eit; ++it ) v += *it; gettimeofday(&end, NULL); return ( (end.tv_sec * 1000000 + end.tv_usec) - (beg.tv_sec * 1000000 + beg.tv_usec) ) / 1000; } // time_iterator() /*----------------------------------------------------------------------------*/ template unsigned int time_copy( SetType& s ) { timeval beg, end; SetType c; gettimeofday(&beg, NULL); c = s; gettimeofday(&end, NULL); return ( (end.tv_sec * 1000000 + end.tv_usec) - (beg.tv_sec * 1000000 + beg.tv_usec) ) / 1000; } // time_copy() /*----------------------------------------------------------------------------*/ template unsigned int time_find( SetType& s, std::vector data ) { timeval beg, end; unsigned int v(0); const unsigned int n = data.size(); const typename SetType::const_iterator eit = s.end(); gettimeofday(&beg, NULL); for (unsigned int i=0; i!=n; ++i) if ( s.find(data[i]) != eit ) v += i; else if ( s.find(i) != eit ) v += i; gettimeofday(&end, NULL); return ( (end.tv_sec * 1000000 + end.tv_usec) - (beg.tv_sec * 1000000 + beg.tv_usec) ) / 1000; } // time_find() /*----------------------------------------------------------------------------*/ template unsigned int time_clear( SetType& s ) { timeval beg, end; gettimeofday(&beg, NULL); s.clear(); gettimeofday(&end, NULL); return ( (end.tv_sec * 1000000 + end.tv_usec) - (beg.tv_sec * 1000000 + beg.tv_usec) ) / 1000; } // time_clear() /*----------------------------------------------------------------------------*/ void do_bench( const std::vector& data ) { std::set s; claw::avl a; std::cout << data.size() << '\t' << time_insert(a, data) << ' ' << time_insert(s, data) << '\t' << time_insert_it(a, data) << ' ' << time_insert_it(s, data) << '\t' << time_iterator(a) << ' ' << time_iterator(s) << '\t' << time_copy(a) << ' ' << time_copy(s) << '\t' << time_find(a, data) << ' ' << time_find(s, data) << '\t' << time_clear(a) << ' ' << time_clear(s) << std::endl; } // do_bench() /*----------------------------------------------------------------------------*/ void benchmark( std::vector& data ) { std::cout << "# milliseconds (avl, std::set)\n"; std::cout << "# n insert insert(it) iterator copy find clear\n"; do_bench(data); std::cout << "# sorted inc\n"; std::sort( data.begin(), data.end() ); do_bench(data); std::cout << "# sorted dec\n"; std::sort( data.begin(), data.end(), std::greater() ); do_bench(data); } // benchmark() int main( int argc, char* argv[] ) { srand(time(NULL)); if (argc != 2) { std::cout << argv[0] << " count" << std::endl; return 1; } else { std::istringstream iss( argv[1] ); unsigned int n; if ( !(iss >> n) ) { std::cerr << "not a number " << argv[1] << std::endl; return 1; } else { std::vector data; data.reserve(n); for (unsigned int i=0; i!=n; ++i) data.push_back( rand() ); benchmark(data); } } return 0; } // main() libclaw-1.7.4/examples/avl/test_files/000077500000000000000000000000001216507631600177105ustar00rootroot00000000000000libclaw-1.7.4/examples/avl/test_files/expected/000077500000000000000000000000001216507631600215115ustar00rootroot00000000000000libclaw-1.7.4/examples/avl/test_files/expected/arb_set_100_1.out000066400000000000000000000456021216507631600244700ustar00rootroot00000000000000Tree is empty File loading... size : 95 Min = 12 Max = 982 Tree's not empty Found : 12 18 30 54 56 62 75 85 Scan with an iterator : 12 18 30 54 56 62 75 85 102 103 104 115 146 159 165 167 199 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 Scan bis, iterator affectation :12: 12 18 30 54 56 62 75 85 102 103 104 115 146 159 165 167 199 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 18: 18 30 54 56 62 75 85 102 103 104 115 146 159 165 167 199 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 30: 30 54 56 62 75 85 102 103 104 115 146 159 165 167 199 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 54: 54 56 62 75 85 102 103 104 115 146 159 165 167 199 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 56: 56 62 75 85 102 103 104 115 146 159 165 167 199 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 62: 62 75 85 102 103 104 115 146 159 165 167 199 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 75: 75 85 102 103 104 115 146 159 165 167 199 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 85: 85 102 103 104 115 146 159 165 167 199 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 102: 102 103 104 115 146 159 165 167 199 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 103: 103 104 115 146 159 165 167 199 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 104: 104 115 146 159 165 167 199 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 115: 115 146 159 165 167 199 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 146: 146 159 165 167 199 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 159: 159 165 167 199 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 165: 165 167 199 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 167: 167 199 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 199: 199 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 208: 208 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 216: 216 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 217: 217 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 226: 226 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 233: 233 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 248: 248 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 254: 254 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 263: 263 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 268: 268 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 290: 290 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 297: 297 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 304: 304 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 315: 315 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 320: 320 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 353: 353 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 356: 356 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 369: 369 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 380: 380 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 382: 382 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 405: 405 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 409: 409 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 417: 417 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 433: 433 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 440: 440 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 455: 455 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 459: 459 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 472: 472 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 473: 473 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 476: 476 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 484: 484 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 515: 515 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 528: 528 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 533: 533 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 534: 534 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 536: 536 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 558: 558 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 573: 573 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 584: 584 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 594: 594 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 595: 595 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 600: 600 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 604: 604 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 605: 605 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 615: 615 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 617: 617 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 643: 643 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 649: 649 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 661: 661 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 670: 670 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 697: 697 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 706: 706 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 723: 723 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 731: 731 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 743: 743 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 754: 754 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 760: 760 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 765: 765 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 779: 779 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 789: 789 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 799: 799 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 828: 828 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 837: 837 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 841: 841 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 843: 843 863 870 878 887 890 906 907 926 927 937 962 971 977 982 863: 863 870 878 887 890 906 907 926 927 937 962 971 977 982 870: 870 878 887 890 906 907 926 927 937 962 971 977 982 878: 878 887 890 906 907 926 927 937 962 971 977 982 887: 887 890 906 907 926 927 937 962 971 977 982 890: 890 906 907 926 927 937 962 971 977 982 906: 906 907 926 927 937 962 971 977 982 907: 907 926 927 937 962 971 977 982 926: 926 927 937 962 971 977 982 927: 927 937 962 971 977 982 937: 937 962 971 977 982 962: 962 971 977 982 971: 971 977 982 977: 977 982 982: 982 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/arb_set_100_2.out000066400000000000000000000506361216507631600244740ustar00rootroot00000000000000Tree is empty File loading... size : 99 Min = 6 Max = 997 Tree's not empty Found : 6 30 31 43 46 52 56 65 76 84 99 Scan with an iterator : 6 30 31 43 46 52 56 65 76 84 99 100 106 111 118 128 139 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 Scan bis, iterator affectation :6: 6 30 31 43 46 52 56 65 76 84 99 100 106 111 118 128 139 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 30: 30 31 43 46 52 56 65 76 84 99 100 106 111 118 128 139 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 31: 31 43 46 52 56 65 76 84 99 100 106 111 118 128 139 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 43: 43 46 52 56 65 76 84 99 100 106 111 118 128 139 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 46: 46 52 56 65 76 84 99 100 106 111 118 128 139 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 52: 52 56 65 76 84 99 100 106 111 118 128 139 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 56: 56 65 76 84 99 100 106 111 118 128 139 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 65: 65 76 84 99 100 106 111 118 128 139 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 76: 76 84 99 100 106 111 118 128 139 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 84: 84 99 100 106 111 118 128 139 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 99: 99 100 106 111 118 128 139 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 100: 100 106 111 118 128 139 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 106: 106 111 118 128 139 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 111: 111 118 128 139 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 118: 118 128 139 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 128: 128 139 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 139: 139 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 178: 178 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 191: 191 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 205: 205 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 221: 221 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 226: 226 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 255: 255 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 269: 269 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 284: 284 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 293: 293 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 294: 294 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 297: 297 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 306: 306 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 317: 317 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 325: 325 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 326: 326 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 329: 329 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 337: 337 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 364: 364 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 378: 378 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 383: 383 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 394: 394 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 401: 401 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 411: 411 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 425: 425 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 450: 450 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 479: 479 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 480: 480 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 501: 501 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 503: 503 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 510: 510 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 528: 528 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 530: 530 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 535: 535 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 553: 553 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 554: 554 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 563: 563 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 565: 565 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 576: 576 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 589: 589 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 590: 590 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 608: 608 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 612: 612 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 623: 623 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 636: 636 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 640: 640 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 641: 641 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 648: 648 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 651: 651 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 662: 662 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 690: 690 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 694: 694 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 713: 713 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 720: 720 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 722: 722 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 725: 725 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 727: 727 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 729: 729 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 741: 741 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 742: 742 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 750: 750 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 774: 774 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 781: 781 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 805: 805 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 811: 811 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 813: 813 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 831: 831 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 870: 870 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 875: 875 888 897 902 905 927 931 932 937 942 947 950 968 984 997 888: 888 897 902 905 927 931 932 937 942 947 950 968 984 997 897: 897 902 905 927 931 932 937 942 947 950 968 984 997 902: 902 905 927 931 932 937 942 947 950 968 984 997 905: 905 927 931 932 937 942 947 950 968 984 997 927: 927 931 932 937 942 947 950 968 984 997 931: 931 932 937 942 947 950 968 984 997 932: 932 937 942 947 950 968 984 997 937: 937 942 947 950 968 984 997 942: 942 947 950 968 984 997 947: 947 950 968 984 997 950: 950 968 984 997 968: 968 984 997 984: 984 997 997: 997 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/arb_set_10_1.out000066400000000000000000000010051216507631600243750ustar00rootroot00000000000000Tree is empty File loading... size : 10 Min = 0 Max = 86 Tree's not empty Found : 0 8 24 33 38 48 73 79 82 86 Scan with an iterator : 0 8 24 33 38 48 73 79 82 86 Scan bis, iterator affectation :0: 0 8 24 33 38 48 73 79 82 86 8: 8 24 33 38 48 73 79 82 86 24: 24 33 38 48 73 79 82 86 33: 33 38 48 73 79 82 86 38: 38 48 73 79 82 86 48: 48 73 79 82 86 73: 73 79 82 86 79: 79 82 86 82: 82 86 86: 86 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/arb_set_10_2.out000066400000000000000000000010121216507631600243740ustar00rootroot00000000000000Tree is empty File loading... size : 10 Min = 4 Max = 83 Tree's not empty Found : 4 11 20 30 38 43 73 75 77 83 Scan with an iterator : 4 11 20 30 38 43 73 75 77 83 Scan bis, iterator affectation :4: 4 11 20 30 38 43 73 75 77 83 11: 11 20 30 38 43 73 75 77 83 20: 20 30 38 43 73 75 77 83 30: 30 38 43 73 75 77 83 38: 38 43 73 75 77 83 43: 43 73 75 77 83 73: 73 75 77 83 75: 75 77 83 77: 77 83 83: 83 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/arb_set_10_3.out000066400000000000000000000010651216507631600244050ustar00rootroot00000000000000Tree is empty File loading... size : 11 Min = 2 Max = 88 Tree's not empty Found : 2 17 22 28 31 37 57 62 76 78 88 Scan with an iterator : 2 17 22 28 31 37 57 62 76 78 88 Scan bis, iterator affectation :2: 2 17 22 28 31 37 57 62 76 78 88 17: 17 22 28 31 37 57 62 76 78 88 22: 22 28 31 37 57 62 76 78 88 28: 28 31 37 57 62 76 78 88 31: 31 37 57 62 76 78 88 37: 37 57 62 76 78 88 57: 57 62 76 78 88 62: 62 76 78 88 76: 76 78 88 78: 78 88 88: 88 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/arb_set_10_4.out000066400000000000000000000010721216507631600244040ustar00rootroot00000000000000Tree is empty File loading... size : 11 Min = 11 Max = 87 Tree's not empty Found : 11 30 40 45 51 61 66 74 79 80 87 Scan with an iterator : 11 30 40 45 51 61 66 74 79 80 87 Scan bis, iterator affectation :11: 11 30 40 45 51 61 66 74 79 80 87 30: 30 40 45 51 61 66 74 79 80 87 40: 40 45 51 61 66 74 79 80 87 45: 45 51 61 66 74 79 80 87 51: 51 61 66 74 79 80 87 61: 61 66 74 79 80 87 66: 66 74 79 80 87 74: 74 79 80 87 79: 79 80 87 80: 80 87 87: 87 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/arb_set_10_5.out000066400000000000000000000010651216507631600244070ustar00rootroot00000000000000Tree is empty File loading... size : 11 Min = 8 Max = 89 Tree's not empty Found : 8 25 28 29 32 34 60 73 80 83 89 Scan with an iterator : 8 25 28 29 32 34 60 73 80 83 89 Scan bis, iterator affectation :8: 8 25 28 29 32 34 60 73 80 83 89 25: 25 28 29 32 34 60 73 80 83 89 28: 28 29 32 34 60 73 80 83 89 29: 29 32 34 60 73 80 83 89 32: 32 34 60 73 80 83 89 34: 34 60 73 80 83 89 60: 60 73 80 83 89 73: 73 80 83 89 80: 80 83 89 83: 83 89 89: 89 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/arb_set_10_6.out000066400000000000000000000010601216507631600244030ustar00rootroot00000000000000Tree is empty File loading... size : 11 Min = 0 Max = 93 Tree's not empty Found : 0 8 34 40 70 73 74 80 83 86 93 Scan with an iterator : 0 8 34 40 70 73 74 80 83 86 93 Scan bis, iterator affectation :0: 0 8 34 40 70 73 74 80 83 86 93 8: 8 34 40 70 73 74 80 83 86 93 34: 34 40 70 73 74 80 83 86 93 40: 40 70 73 74 80 83 86 93 70: 70 73 74 80 83 86 93 73: 73 74 80 83 86 93 74: 74 80 83 86 93 80: 80 83 86 93 83: 83 86 93 86: 86 93 93: 93 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/arb_set_10_7.out000066400000000000000000000010651216507631600244110ustar00rootroot00000000000000Tree is empty File loading... size : 11 Min = 8 Max = 96 Tree's not empty Found : 8 11 13 20 35 44 56 72 77 93 96 Scan with an iterator : 8 11 13 20 35 44 56 72 77 93 96 Scan bis, iterator affectation :8: 8 11 13 20 35 44 56 72 77 93 96 11: 11 13 20 35 44 56 72 77 93 96 13: 13 20 35 44 56 72 77 93 96 20: 20 35 44 56 72 77 93 96 35: 35 44 56 72 77 93 96 44: 44 56 72 77 93 96 56: 56 72 77 93 96 72: 72 77 93 96 77: 77 93 96 93: 93 96 96: 96 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/arb_set_10_8.out000066400000000000000000000010171216507631600244070ustar00rootroot00000000000000Tree is empty File loading... size : 10 Min = 19 Max = 97 Tree's not empty Found : 19 28 33 48 50 51 57 63 83 97 Scan with an iterator : 19 28 33 48 50 51 57 63 83 97 Scan bis, iterator affectation :19: 19 28 33 48 50 51 57 63 83 97 28: 28 33 48 50 51 57 63 83 97 33: 33 48 50 51 57 63 83 97 48: 48 50 51 57 63 83 97 50: 50 51 57 63 83 97 51: 51 57 63 83 97 57: 57 63 83 97 63: 63 83 97 83: 83 97 97: 97 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/arb_set_10_9.out000066400000000000000000000007461216507631600244200ustar00rootroot00000000000000Tree is empty File loading... size : 9 Min = 11 Max = 89 Tree's not empty Found : 11 15 19 46 50 71 85 86 89 Scan with an iterator : 11 15 19 46 50 71 85 86 89 Scan bis, iterator affectation :11: 11 15 19 46 50 71 85 86 89 15: 15 19 46 50 71 85 86 89 19: 19 46 50 71 85 86 89 46: 46 50 71 85 86 89 50: 50 71 85 86 89 71: 71 85 86 89 85: 85 86 89 86: 86 89 89: 89 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/arb_set_50_1.out000066400000000000000000000117511216507631600244120ustar00rootroot00000000000000Tree is empty File loading... size : 47 Min = 0 Max = 486 Tree's not empty Found : 0 4 11 12 16 24 30 32 33 55 61 69 82 89 Scan with an iterator : 0 4 11 12 16 24 30 32 33 55 61 69 82 89 100 103 126 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 Scan bis, iterator affectation :0: 0 4 11 12 16 24 30 32 33 55 61 69 82 89 100 103 126 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 4: 4 11 12 16 24 30 32 33 55 61 69 82 89 100 103 126 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 11: 11 12 16 24 30 32 33 55 61 69 82 89 100 103 126 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 12: 12 16 24 30 32 33 55 61 69 82 89 100 103 126 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 16: 16 24 30 32 33 55 61 69 82 89 100 103 126 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 24: 24 30 32 33 55 61 69 82 89 100 103 126 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 30: 30 32 33 55 61 69 82 89 100 103 126 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 32: 32 33 55 61 69 82 89 100 103 126 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 33: 33 55 61 69 82 89 100 103 126 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 55: 55 61 69 82 89 100 103 126 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 61: 61 69 82 89 100 103 126 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 69: 69 82 89 100 103 126 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 82: 82 89 100 103 126 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 89: 89 100 103 126 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 100: 100 103 126 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 103: 103 126 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 126: 126 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 128: 128 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 133: 133 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 139: 139 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 143: 143 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 144: 144 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 146: 146 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 162: 162 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 164: 164 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 179: 179 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 186: 186 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 188: 188 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 216: 216 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 227: 227 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 233: 233 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 243: 243 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 268: 268 286 288 343 358 371 372 414 429 434 443 450 477 485 486 286: 286 288 343 358 371 372 414 429 434 443 450 477 485 486 288: 288 343 358 371 372 414 429 434 443 450 477 485 486 343: 343 358 371 372 414 429 434 443 450 477 485 486 358: 358 371 372 414 429 434 443 450 477 485 486 371: 371 372 414 429 434 443 450 477 485 486 372: 372 414 429 434 443 450 477 485 486 414: 414 429 434 443 450 477 485 486 429: 429 434 443 450 477 485 486 434: 434 443 450 477 485 486 443: 443 450 477 485 486 450: 450 477 485 486 477: 477 485 486 485: 485 486 486: 486 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/custom_12.out000066400000000000000000000010371216507631600240570ustar00rootroot00000000000000Tree is empty File loading... size : 12 Min = 1 Max = 12 Tree's not empty Found : 1 2 3 4 5 6 7 8 9 10 11 12 Scan with an iterator : 1 2 3 4 5 6 7 8 9 10 11 12 Scan bis, iterator affectation :1: 1 2 3 4 5 6 7 8 9 10 11 12 2: 2 3 4 5 6 7 8 9 10 11 12 3: 3 4 5 6 7 8 9 10 11 12 4: 4 5 6 7 8 9 10 11 12 5: 5 6 7 8 9 10 11 12 6: 6 7 8 9 10 11 12 7: 7 8 9 10 11 12 8: 8 9 10 11 12 9: 9 10 11 12 10: 10 11 12 11: 11 12 12: 12 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/custom_7.out000066400000000000000000000005541216507631600240060ustar00rootroot00000000000000Tree is empty File loading... size : 7 Min = 0 Max = 6 Tree's not empty Found : 0 1 2 3 4 5 6 Scan with an iterator : 0 1 2 3 4 5 6 Scan bis, iterator affectation :0: 0 1 2 3 4 5 6 1: 1 2 3 4 5 6 2: 2 3 4 5 6 3: 3 4 5 6 4: 4 5 6 5: 5 6 6: 6 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/custom_croissant_10.out000066400000000000000000000007061216507631600261440ustar00rootroot00000000000000Tree is empty File loading... size : 10 Min = 1 Max = 10 Tree's not empty Found : 1 2 3 4 5 6 7 8 9 10 Scan with an iterator : 1 2 3 4 5 6 7 8 9 10 Scan bis, iterator affectation :1: 1 2 3 4 5 6 7 8 9 10 2: 2 3 4 5 6 7 8 9 10 3: 3 4 5 6 7 8 9 10 4: 4 5 6 7 8 9 10 5: 5 6 7 8 9 10 6: 6 7 8 9 10 7: 7 8 9 10 8: 8 9 10 9: 9 10 10: 10 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/custom_croissant_20.out000066400000000000000000000017731216507631600261520ustar00rootroot00000000000000Tree is empty File loading... size : 20 Min = 1 Max = 20 Tree's not empty Found : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Scan with an iterator : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Scan bis, iterator affectation :1: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 3: 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4: 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 5: 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 6: 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 7: 7 8 9 10 11 12 13 14 15 16 17 18 19 20 8: 8 9 10 11 12 13 14 15 16 17 18 19 20 9: 9 10 11 12 13 14 15 16 17 18 19 20 10: 10 11 12 13 14 15 16 17 18 19 20 11: 11 12 13 14 15 16 17 18 19 20 12: 12 13 14 15 16 17 18 19 20 13: 13 14 15 16 17 18 19 20 14: 14 15 16 17 18 19 20 15: 15 16 17 18 19 20 16: 16 17 18 19 20 17: 17 18 19 20 18: 18 19 20 19: 19 20 20: 20 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/custom_croissant_30.out000066400000000000000000000035341216507631600261500ustar00rootroot00000000000000Tree is empty File loading... size : 30 Min = 1 Max = 30 Tree's not empty Found : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Scan with an iterator : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Scan bis, iterator affectation :1: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 2: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 3: 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 4: 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 5: 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 6: 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 7: 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 8: 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 9: 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 10: 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 11: 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 12: 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 13: 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 14: 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 15: 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 16: 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 17: 17 18 19 20 21 22 23 24 25 26 27 28 29 30 18: 18 19 20 21 22 23 24 25 26 27 28 29 30 19: 19 20 21 22 23 24 25 26 27 28 29 30 20: 20 21 22 23 24 25 26 27 28 29 30 21: 21 22 23 24 25 26 27 28 29 30 22: 22 23 24 25 26 27 28 29 30 23: 23 24 25 26 27 28 29 30 24: 24 25 26 27 28 29 30 25: 25 26 27 28 29 30 26: 26 27 28 29 30 27: 27 28 29 30 28: 28 29 30 29: 29 30 30: 30 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/custom_decroissant_10.out000066400000000000000000000007061216507631600264550ustar00rootroot00000000000000Tree is empty File loading... size : 10 Min = 1 Max = 10 Tree's not empty Found : 1 2 3 4 5 6 7 8 9 10 Scan with an iterator : 1 2 3 4 5 6 7 8 9 10 Scan bis, iterator affectation :1: 1 2 3 4 5 6 7 8 9 10 2: 2 3 4 5 6 7 8 9 10 3: 3 4 5 6 7 8 9 10 4: 4 5 6 7 8 9 10 5: 5 6 7 8 9 10 6: 6 7 8 9 10 7: 7 8 9 10 8: 8 9 10 9: 9 10 10: 10 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/ex_cours_11_1.out000066400000000000000000000010521216507631600246100ustar00rootroot00000000000000Tree is empty File loading... size : 11 Min = 3 Max = 40 Tree's not empty Found : 3 4 7 10 12 13 15 20 30 35 40 Scan with an iterator : 3 4 7 10 12 13 15 20 30 35 40 Scan bis, iterator affectation :3: 3 4 7 10 12 13 15 20 30 35 40 4: 4 7 10 12 13 15 20 30 35 40 7: 7 10 12 13 15 20 30 35 40 10: 10 12 13 15 20 30 35 40 12: 12 13 15 20 30 35 40 13: 13 15 20 30 35 40 15: 15 20 30 35 40 20: 20 30 35 40 30: 30 35 40 35: 35 40 40: 40 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/ex_cours_8_1.out000066400000000000000000000006031216507631600245370ustar00rootroot00000000000000Tree is empty File loading... size : 8 Min = 0 Max = 8 Tree's not empty Found : 0 1 2 3 4 6 7 8 Scan with an iterator : 0 1 2 3 4 6 7 8 Scan bis, iterator affectation :0: 0 1 2 3 4 6 7 8 1: 1 2 3 4 6 7 8 2: 2 3 4 6 7 8 3: 3 4 6 7 8 4: 4 6 7 8 6: 6 7 8 7: 7 8 8: 8 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/expected/ex_livre_10_1.out000066400000000000000000000007771216507631600246120ustar00rootroot00000000000000Tree is empty File loading... size : 10 Min = 3 Max = 40 Tree's not empty Found : 3 4 7 10 12 13 15 30 35 40 Scan with an iterator : 3 4 7 10 12 13 15 30 35 40 Scan bis, iterator affectation :3: 3 4 7 10 12 13 15 30 35 40 4: 4 7 10 12 13 15 30 35 40 7: 7 10 12 13 15 30 35 40 10: 10 12 13 15 30 35 40 12: 12 13 15 30 35 40 13: 13 15 30 35 40 15: 15 30 35 40 30: 30 35 40 35: 35 40 40: 40 Deletions Copy and scan source size : 0 copy size : 0 Tree's copy is empty Reverse scan Assignment Clear Tree's is empty libclaw-1.7.4/examples/avl/test_files/tree/000077500000000000000000000000001216507631600206475ustar00rootroot00000000000000libclaw-1.7.4/examples/avl/test_files/tree/arb_set_10000_1000066400000000000000000001627611216507631600231660ustar00rootroot00000000000000 38460 95436 50488 46165 99411 28833 61365 23424 17152 60220 58954 50853 32881 37554 67875 50753 29081 3105 23770 97795 36395 71599 82768 60097 7799 44789 13080 50954 45976 92135 17161 33400 94875 52290 57876 44783 31344 35069 87108 33550 17820 28596 241 25432 1971 41317 64966 61204 74268 33559 97837 73216 19387 18331 87017 92884 22408 36048 84655 6321 15732 32870 17331 306 77660 97344 88000 65766 18565 35026 67883 50970 15606 85790 1735 81615 81912 13492 74925 89994 81172 22690 15776 20436 23578 82094 31596 3199 4053 59455 1832 14013 68696 97555 76797 61448 20397 86005 55397 69309 99537 8526 40301 46230 734 70414 93991 59673 11558 35856 44125 56496 84154 29811 11656 97303 75713 84115 60145 96743 18735 32526 89696 86957 7004 84370 23965 46356 8230 31493 63668 60916 39288 68204 5032 10187 64988 28891 46625 95189 6327 72995 33004 50394 69139 72049 8610 6979 29101 78436 80367 99529 34023 80592 12396 33394 9355 74309 1304 54870 77866 4841 5478 91405 29406 59506 26810 54009 1716 15456 68317 19059 58200 72310 16060 31687 73617 24343 18832 97938 63613 51910 64026 57883 19043 36795 73141 56875 31010 31177 65344 57144 17573 34894 62552 56906 88044 60692 34433 9178 5826 92159 6808 57491 35718 64013 81857 30685 86636 19445 43580 63968 85681 24201 46951 38442 44486 42088 14204 56265 3792 1595 86679 93646 67183 8310 5678 98863 59917 82833 20758 27490 73791 28860 48903 32008 83986 61128 33019 48009 48811 47918 73173 44166 28302 47788 29031 28158 82607 45240 16921 25741 36088 14993 49964 75152 18090 69559 94709 4031 16300 69814 42706 81051 3646 3232 20468 59442 24673 59494 86232 54596 52315 58139 86994 22945 51033 7962 74220 34294 7221 2830 1691 54794 12848 83614 53918 82756 13251 20924 78557 4478 55033 98332 21263 62280 94988 762 86432 51939 56007 37759 72247 91692 40887 56297 53488 30029 39994 22825 10532 84425 93706 79249 27973 28225 95580 2514 11321 67860 47185 22501 95198 77583 519 77895 41474 83910 48977 14747 50787 16957 52782 57388 35874 70858 9828 6393 30162 40454 7870 43293 30044 26439 19003 46702 94290 26149 22361 49564 49017 52181 65972 92195 71672 46040 3721 50825 52449 78985 68334 46299 56587 57268 66352 62653 35989 73966 5999 30242 63586 74570 93905 53095 88898 28538 61617 85208 38228 23993 7826 85442 7911 27748 67258 5729 24079 77855 42166 92257 67358 861 57345 4340 85950 70956 24636 80643 45529 53202 27826 7469 89392 98038 63908 68770 7296 79235 1612 82594 36434 92497 43173 53644 42972 56902 249 96635 57582 86345 19944 10138 63435 23209 21856 5607 60053 51415 32112 21258 51493 31063 25298 75514 32274 21832 10249 39671 69502 87354 20617 34503 4620 97714 96164 80475 23230 72296 65714 56257 66408 30140 67706 45227 81977 40010 69278 74647 39140 87356 69823 77210 54944 358 99963 29628 5991 2239 51861 47965 23845 82035 1823 44390 97558 1008 11122 75055 31778 76898 15984 33754 33846 13183 42668 71095 28343 65558 8582 43823 22513 62798 95375 24024 71005 24211 4936 22876 13363 40858 34241 8629 82714 12727 29983 23522 9084 59057 8934 29313 65773 43986 54954 36096 32246 84731 28605 94127 71954 34461 50303 53306 48540 57075 42935 20038 28864 36057 44892 66133 46270 84601 29445 69453 22563 49195 91414 90979 72095 23849 87049 17994 36433 17151 38079 28066 23023 39350 35857 53520 46294 1638 6538 51084 94651 44833 23233 6401 71770 39642 76067 28089 85659 25691 36096 11041 83906 81514 73994 73652 58552 42688 19478 98654 69038 10297 72380 32258 56651 16921 1326 21282 48910 42320 90948 92953 77335 96031 23561 7075 57035 9028 6263 35244 1536 1666 79375 46809 71321 20072 67163 6246 79478 58188 56794 11661 2932 7641 16437 29081 72670 2636 88477 2237 41409 52053 18753 42526 52149 75940 7774 28836 56034 88587 94842 71914 52972 95374 11028 22983 53448 95569 61926 31279 84959 8276 26133 80198 91521 63711 80394 56754 99681 27002 87335 34017 49465 46693 6739 71226 13708 45142 16290 61271 54204 93003 52730 80224 88099 34977 9364 18606 62990 59020 50847 99079 64141 26192 31196 10256 2272 3348 25959 11311 55347 65837 14492 87070 62810 62410 73253 58287 95692 59535 66088 76780 51044 7275 42414 60114 44111 93950 79254 45529 96712 81748 28056 67789 45237 40489 52241 90644 16717 21707 66400 46597 46394 40269 13097 64655 35241 55686 38205 90760 70843 70327 50712 30575 60116 86712 77945 69335 47266 91078 52129 48419 15442 55394 89244 3363 95518 75030 46095 92978 30448 84254 66549 74268 68612 16743 52866 2844 84616 3314 23066 63503 50964 24038 40267 60682 9045 56938 24935 23450 12884 90461 85986 4753 44069 91907 31663 79570 21321 48994 46142 71691 53122 26766 42800 63797 6851 7014 30076 70521 92858 2403 50872 79192 86922 62502 81418 87937 39518 13886 560 95837 45347 1511 65384 24822 71546 23551 54130 77987 68042 76871 62331 64026 8456 55337 63108 42464 35024 68149 67566 69383 5950 70371 46219 48311 68647 22866 97398 15990 7285 23805 73558 17684 38099 78952 1441 51729 50890 2901 57023 88008 20143 68461 81174 90039 34233 46369 46995 95367 16108 2529 14738 33939 33939 44950 35268 89159 25130 37587 87998 31305 82157 23254 64228 77993 73649 22820 31843 61390 99176 2846 42282 6836 1147 28880 65744 52598 82293 46579 65540 65411 2141 57847 47555 31511 50933 84185 45740 27847 24426 34436 29572 3155 48008 19107 44434 23578 23566 78464 20834 62532 97545 16586 13413 39489 73639 58556 55678 37386 18545 72996 41388 53318 34225 27108 68546 62233 95103 66433 6920 98298 73651 36498 75040 83629 2777 88548 37601 59065 48482 36547 59222 96696 91201 57634 75480 98797 39267 53228 67174 12895 22955 12961 48746 17620 42522 48630 6799 59052 68685 90363 49656 42249 18984 62168 53880 7625 58462 79075 18717 46893 98093 33041 64378 38235 89407 59816 35111 5402 38741 3948 92993 30432 89555 24127 13382 74662 46260 6044 17967 87727 37973 74957 6356 9246 45667 25154 72135 92857 41125 8498 14331 7314 11155 49235 80235 94314 65492 77270 499 87758 51834 97081 2460 24116 26438 34462 12628 98602 53726 28292 84263 46831 33327 59510 10994 56652 78004 34479 12410 39850 90891 64939 2558 18391 15488 11726 77289 4912 56846 84448 81395 82132 97382 14305 41460 10877 55759 42243 75378 21411 62272 89630 14464 67746 49169 3628 99103 49639 79363 94474 33873 31940 61947 6834 13071 16002 27975 92427 52598 42820 64921 76111 89117 32604 33283 32608 32443 90459 13738 16063 82089 32870 58311 9625 43910 14671 43982 87230 7781 61194 52171 4786 72253 35278 22543 62929 27109 93834 54560 8562 29782 13639 55233 67337 36542 91066 56497 24294 74419 45419 50653 94825 64780 80576 17319 53158 34503 84614 40312 10550 75688 72114 37921 60374 39843 98827 54990 32286 77473 3390 90251 22667 59024 55786 57359 93512 38111 17222 3047 56977 42962 41124 30850 87745 7032 69935 3835 30422 74707 7397 24769 94131 43046 71011 17168 51508 25498 54360 55663 84277 48524 53984 19117 42591 17071 40489 64939 10338 9828 78590 48019 93584 90209 25757 32734 74352 43989 64169 71460 96922 79548 45655 48023 78830 51639 54308 9527 63773 94636 16466 34998 58586 76189 12741 14292 21496 7230 71788 35677 93827 69259 50500 5560 92355 44857 30311 48772 4488 62358 84310 62858 53476 90617 94834 24810 25817 44815 26240 73678 78064 89236 82544 17497 65212 47955 4601 37969 57857 59372 86537 91336 40307 35532 16092 28881 6842 12169 68591 85496 98306 408 9203 9754 46215 76065 83193 33924 16573 67483 98857 7362 70589 27841 32807 41720 84464 2872 12316 41407 95459 29929 54400 17746 66414 29338 66323 10255 85910 73968 37218 63499 46273 47971 75505 32937 66581 30606 71805 18226 52894 66115 92018 47385 12870 5556 30279 60292 66965 31553 76449 64924 23402 1898 77856 64795 9099 72931 99959 81018 73737 88641 15621 17436 9167 46440 77688 42259 51329 75518 54553 84636 56885 88747 33398 69612 71740 94048 20799 39899 33650 76174 95376 37903 76098 84837 92195 46437 25626 90125 23579 11567 9812 91135 66044 96027 18079 88771 68033 36633 82528 58639 58134 4138 70966 84975 58482 88973 9344 41547 33015 61293 75766 30472 25288 78790 33270 14866 65521 40686 93570 6301 51576 11362 28936 92963 33544 62051 74415 19485 56636 4034 87558 54372 42058 11779 57870 5959 10568 59459 83143 72847 78391 19284 54874 39747 80185 95091 19956 54669 98749 89621 10820 48399 6154 28927 61226 82198 45990 92352 49889 34663 11405 21502 39111 63680 98646 6668 641 4420 40768 74125 45906 89301 51201 22747 2846 863 31880 83376 6504 93490 25606 99381 95575 44921 17331 51848 32108 23476 14061 77836 86530 81948 58059 55137 55194 14092 53033 51975 2635 34645 8004 65087 45717 68828 28533 94619 21868 62244 10002 29277 8576 47139 12634 40169 86350 25935 22936 6771 62323 57996 31253 23471 96681 60547 80132 60104 99124 59695 63166 74935 87522 52480 79013 3524 25972 65907 70286 71900 84436 23879 1988 7490 87146 57985 59186 46250 41970 23068 68610 59409 67921 3519 73871 48288 62994 21230 18969 80628 79531 81142 19803 66845 99284 15334 28342 99679 25380 11580 19173 5651 33361 37317 53090 81772 48501 94962 97426 15953 41573 69512 7810 14532 60268 54370 1034 85380 38437 66327 73728 49997 50359 85648 46516 83062 2216 82180 38353 2856 77961 13453 719 60997 81765 5672 66373 4942 44240 53565 92334 11666 84611 19 1801 15978 46042 81433 54672 81903 46287 49734 1378 90563 10862 6988 99691 43009 80924 13553 99219 1420 13049 55694 23262 17125 13084 83618 2711 18883 71274 55853 41699 59843 90845 50906 19663 46643 27231 32158 59531 99074 80136 76905 16703 13740 5608 5503 68522 30170 40328 71549 8926 22802 55291 99032 77950 67286 81065 77395 80795 54540 71828 50445 76125 50998 351 60051 38289 28489 1139 30557 23165 12176 3888 4861 92297 20003 24478 68095 75021 92090 5660 19829 73272 33493 24644 80759 38747 18789 9768 44801 77127 31919 33438 12526 59027 39711 73519 66895 42383 22539 60380 77202 35944 10550 51760 42183 58568 98892 2665 8227 74008 40379 22464 23614 5868 39047 36379 14731 62428 93011 93566 95199 26019 60092 88953 43841 86633 44619 91048 12442 24462 28877 92881 49230 71048 97603 28280 49015 3738 29006 20675 65926 53118 50708 56597 49689 28137 84080 1080 91366 88579 25388 97143 89516 19598 37189 16536 72698 87983 48427 53953 39257 84855 86651 81881 340 84472 90804 8289 37063 73837 78010 4324 7783 32798 62811 94228 66401 69315 52274 24644 77642 39601 65420 55497 40238 7804 50406 39659 53967 24932 97899 83557 91469 31706 74073 5935 60794 15021 21682 36941 69597 72712 2630 24743 26948 66306 80484 41840 43660 66451 66367 8278 17103 20707 76668 73939 11417 98387 76001 27110 69082 92143 3863 21500 14769 80967 8415 38905 37414 84314 35832 29703 61448 62020 48654 98376 43136 39716 71587 26227 52939 64406 88166 48503 29854 19920 36757 28091 18664 56913 79293 92988 26038 17096 41209 29733 56410 56407 46013 49969 13587 96782 92908 72353 79010 61232 50934 86977 2625 71910 68040 94496 67271 15852 18537 37154 12561 8079 37375 63887 29155 6756 14664 96705 59393 60081 48890 90518 65208 89606 82264 3617 49261 39669 66630 20983 40240 47629 33383 97615 78252 14586 65827 14066 61255 81275 97408 61375 38456 38834 84271 97576 61628 29107 25559 42984 30269 14200 29921 6431 91542 19954 51629 59651 80949 83031 44777 1996 14657 56309 8977 82670 69421 52253 24995 72670 11048 28975 3773 3626 57330 48646 97256 15718 86384 62966 44486 81862 26347 5370 51379 361 87352 94657 27631 73187 21723 79737 29193 12109 23342 80177 79754 39834 2095 2232 69653 78351 94375 35061 55684 41677 95539 56791 10205 75184 25284 5148 93014 8689 61874 92319 44405 15507 6141 68732 22855 94650 61221 65468 35785 18351 38939 69954 36817 12113 28802 14659 87973 59466 90519 83457 10258 48613 55999 65356 71056 3161 51755 10280 81777 64125 77658 66586 4201 15384 2977 5008 88949 69781 65640 58717 94520 58062 85655 34174 60327 87826 28630 72480 32187 64686 80328 65899 63675 92828 18192 59241 41807 97146 90784 90799 10467 34146 41069 52525 90032 83817 34486 74128 16625 39633 77742 60791 49428 38897 39259 39180 19512 601 7233 91454 18593 62992 46212 81935 51177 38032 38159 6158 98521 24948 18921 16957 67843 50037 46041 7301 25227 24944 58861 54546 35654 40570 16850 55808 58604 38822 27083 9132 72660 29383 96822 20152 27548 43678 72141 38926 47067 43246 48506 56633 31323 24691 64279 16820 31726 88399 13068 20893 97175 63216 35854 32529 14872 4268 78852 10699 94203 6116 28020 25999 67122 98426 56177 39960 3476 16351 43652 52046 64713 62802 58399 44002 44399 4808 6534 76262 68996 71141 89210 16091 57328 43395 26782 2157 62177 57719 36195 75209 42443 59370 72527 29563 39311 77299 70636 65074 54859 10931 47841 44280 56543 46347 53570 84416 55998 44049 76923 38973 35599 65489 48087 48498 21203 30559 94523 65322 24530 23223 37890 81893 3605 87488 42623 17421 14704 80882 52101 42503 54244 77650 73368 46427 14049 38840 96309 76837 98433 91473 58247 6454 76542 83979 89881 6530 68376 10094 3517 31728 87953 18397 9513 46120 92032 49686 71889 44980 7840 69367 39037 52069 38240 87051 10456 97097 67786 80551 25473 3040 18079 66453 84868 38020 25895 84461 41339 11414 42487 87702 19768 18892 77532 56167 53198 66070 36131 75493 45471 25459 22319 48260 96469 6407 7519 29993 50888 42713 87370 7065 56479 27612 75372 58673 42711 50796 6790 70096 55768 17191 51241 89395 10843 52145 57416 44773 47645 22739 78368 64751 73 29892 50804 68379 15988 50962 26813 17645 88012 37513 81480 49276 81307 97953 44812 28131 69265 19722 31423 89357 13040 10715 66400 61500 45869 64628 30813 87766 48114 79931 75276 87612 23966 87125 75023 25855 15746 63995 24920 81488 16737 43543 97858 33393 68499 44276 14961 5138 53580 77550 1050 36032 19587 11650 23794 70654 95537 97296 39998 84013 86430 84266 97447 84545 56981 83813 65763 62130 40456 56577 94698 73316 33537 30665 23308 80938 63160 79606 88443 90315 36268 14843 5991 49220 8405 72474 23312 3809 32102 98916 66305 27690 70978 65175 29537 66326 90511 64429 82876 63959 61396 72592 93069 65238 36445 76552 83697 8744 86958 99779 81946 54598 9505 79977 25629 13332 39052 78479 28907 68227 29378 26067 30134 8287 86708 34901 70264 14048 67514 31254 75275 63410 76405 88737 41017 49672 25059 66690 43955 28957 38123 83446 26218 39235 17029 79142 28408 58093 97649 47768 68594 91484 62744 43142 90943 10605 95131 88500 32410 79114 82509 44385 80936 37865 9885 14522 23588 39349 538 94378 8072 49036 91447 92070 66072 55785 54139 76339 71836 58539 96878 31255 34451 21469 9142 22345 47256 14761 34320 3841 42817 83241 81576 21727 26898 10015 12800 92269 89890 67316 65604 60725 19103 71751 98285 69924 60383 86121 67699 93382 2482 35020 75986 12669 82617 26382 47073 43693 36659 96181 18912 41606 42391 18457 62360 39002 29262 47865 62677 97110 53096 86928 24543 74657 59165 95185 86555 44098 82087 82428 56134 9898 55980 53196 780 8550 33296 94735 56606 95016 35800 25605 40105 45287 86100 47105 74068 29743 93192 64735 63606 36994 90439 71855 83201 52907 49437 12736 60736 24489 18185 67204 69432 63325 57023 24042 63631 68251 70753 35356 19367 71956 60388 69084 65660 41192 42976 1837 17469 85295 12913 19254 46238 52680 43216 16079 48988 20025 50160 13111 1872 3812 69737 33258 9143 48915 19369 3845 83472 73939 43314 77382 18548 77967 65198 87985 39902 38439 96110 85619 44893 54814 71714 15366 67787 17739 16786 33894 30876 8372 60639 80332 67567 57590 51868 43714 28380 19732 45838 94203 5799 40590 63372 70263 38902 24317 44063 38984 83717 28958 42661 71732 60236 45273 41947 2324 12031 38555 80569 59907 39401 58120 19241 93731 91988 44161 93766 32006 31818 86653 28312 42029 2670 15996 7377 83763 66745 30085 29883 74070 94552 87494 93844 3766 18954 21453 85024 74698 89309 54326 68050 49038 86658 17256 3394 27956 85866 4675 38680 1882 75695 18366 47737 39546 72705 80759 15845 7958 89956 22164 94618 40547 46421 71602 74942 95624 28065 5949 51422 72368 36523 37060 76775 76519 86307 41578 29591 52963 36493 63095 43923 27402 67811 41372 74118 24292 41088 48295 93354 53236 97975 35257 49290 81029 89895 21652 25297 31524 46152 79169 80680 80527 17137 91580 68353 37894 53572 94697 53385 34025 7724 26195 80867 52939 67529 39986 66527 79114 59564 64833 8544 50297 81806 11883 43986 33442 52112 60824 98315 65993 83358 79334 1398 29679 21177 55520 68455 49020 5236 48037 69394 31725 39977 83563 34951 93177 85774 56335 73095 32176 6442 9412 94118 50155 34015 2370 67853 31028 36770 95113 61465 23874 1389 2476 31240 95643 65234 99326 66816 46066 59647 80832 11296 1959 50231 7599 5674 33114 85035 90357 31018 56950 86591 93885 46840 24135 48730 64860 49101 2337 24131 13323 96277 320 13516 2441 76932 99550 92459 26258 17232 85515 36714 80132 51834 95936 32029 53514 6599 28060 79361 99803 66552 72225 31445 62919 27538 63876 21643 65309 55003 71236 71018 87075 98344 60797 84570 90885 34263 7841 72566 72388 37561 44160 57909 40796 2810 60175 55476 59335 65348 3638 34365 238 95018 42097 99000 93990 61103 81328 50005 77484 91896 56900 10817 70799 77323 41085 30943 37280 88084 32273 1833 6599 9725 19109 46268 65500 15093 36512 67239 45898 23611 55783 67223 65039 20797 75980 73813 97391 36487 8754 32634 82963 5176 73820 53477 1738 56932 47274 20594 68908 12308 29913 3098 30589 79708 27781 26387 64728 78611 62092 90549 16853 37135 50742 46672 25393 37335 28598 67006 16223 6706 98730 69909 71139 79305 31799 85509 99950 74950 55768 73041 70864 69912 3142 25764 78867 57556 7909 24427 56778 22356 69372 25198 58663 75734 25076 93012 70303 27139 99987 16261 26402 88836 24145 63768 39217 37805 35950 69988 68302 83222 13284 59366 86056 12934 99653 45795 18755 17378 17536 68108 67762 14383 86126 47540 40602 23281 85656 78107 46582 61779 35496 85825 36656 64018 78198 17717 92213 43262 86701 46549 92475 47654 36850 2212 15204 82475 12451 65718 50386 97346 35019 86716 31603 61807 35435 10494 14759 77714 9669 25382 58857 1887 25786 66504 88527 77455 74404 36822 42958 97323 79792 31391 40964 48213 13808 75787 16841 8698 79853 14622 6709 99693 59029 11098 90037 10808 35696 43540 16032 51032 44611 9824 69568 97158 6833 75670 56366 38412 46588 27709 12093 40700 6275 17275 65075 78930 1812 5859 7312 10831 85491 48158 53481 90716 8546 73664 92612 46628 617 52719 62134 69297 8293 57983 98964 86349 59922 57256 47339 20216 48887 98571 28073 53165 52515 73526 98926 47899 28828 69760 60775 97160 58306 48543 89275 774 22865 8386 96689 93572 39220 20637 53591 72633 88837 47974 25111 97280 11653 81757 1425 60257 55753 59162 27165 53553 189 46028 59448 77275 93134 96383 9200 65038 72555 24551 45475 24287 61594 50798 67441 15004 55837 6461 73739 15229 44678 9470 83885 46833 33937 46232 91413 59989 61949 20795 53449 99763 26286 57232 46385 3277 63322 66186 42370 878 47806 11523 86278 19741 4651 37998 77855 13356 50116 45921 88729 65332 4564 23710 68974 40954 43999 74301 22908 84926 82550 96351 58816 88754 3110 6147 42293 76186 78296 11188 7880 80156 48938 71360 8693 9681 52269 8646 8727 30118 17013 51311 47523 5256 67555 23493 31881 74649 4374 16148 34324 64646 52946 271 2972 56551 98275 68349 12541 60343 47272 14970 11137 67411 86144 92527 42542 80716 24991 2963 48670 45845 46801 11484 81895 31375 3023 93184 81919 31988 22913 48517 96889 92789 28835 48556 53433 78238 74707 95973 5309 34157 49779 12675 15362 16243 14931 90050 50459 83518 63676 62734 94107 80154 25063 91858 6434 54125 50654 68706 86215 86105 52777 74717 14645 27058 86232 58775 85529 67963 90647 17717 51593 90094 35658 91011 41588 69317 36115 5520 27891 32820 29492 31306 49273 91723 32695 34413 18538 98006 20445 37548 69707 99192 92439 24619 24443 89218 21463 50054 82402 78936 99648 38844 65197 34685 25063 88247 68660 58358 95827 7087 3097 7419 3922 53590 26217 78295 45905 57692 98421 1581 92706 38760 15148 22509 85687 54655 95950 65096 51165 43085 35007 3432 50573 41176 42740 88524 8461 94214 33235 4155 85511 89466 37149 50174 88759 76056 44800 76673 36214 56800 9108 17473 18060 62956 63100 96374 21620 47822 31644 4583 12289 60121 42111 72784 87600 83101 63654 86267 46630 50306 29784 16559 41921 73935 23932 68006 6110 46741 32695 62724 70456 3404 96435 12371 17441 52309 11941 50170 34649 13677 66814 21631 62098 24978 10293 57392 50219 99567 90183 76631 70661 49480 10589 94484 47125 8332 90142 31900 98396 15241 25387 51378 10777 45734 89053 67022 82098 558 17860 2342 4498 88341 69565 94256 78169 63035 53946 66715 73231 2084 67381 22398 81958 36255 85746 25905 28503 67059 95287 76900 28348 32715 66176 96626 14636 8582 98425 76240 73590 53004 94857 60397 56205 34497 40812 64535 58388 1232 95273 49277 86753 78727 23119 410 52238 6712 23163 87861 58750 51080 31691 2117 79011 51886 6171 91523 34802 93304 18824 48898 23790 6508 14748 20905 60117 41391 14282 38608 20958 68073 64293 92662 16210 94133 68076 1574 23529 8495 48559 46454 55869 87923 24488 70721 53740 27039 4297 68185 19361 77817 27338 7935 34883 9497 7157 69498 31898 24831 56516 86677 4390 93624 98834 23520 82344 89499 95748 30858 8173 40812 45467 56846 83179 31677 31623 9948 76207 14020 27290 97790 11707 16602 83868 90349 79366 61958 59526 80872 32520 27187 66868 43009 67511 9514 44539 7560 1205 82587 82439 7292 88824 54430 55233 63265 49310 62994 43857 11092 90392 70240 49696 90582 50549 40699 31126 47202 50 15442 17104 18783 68270 17393 77502 5930 89460 48932 54863 49555 84159 67720 87269 63970 18447 51682 77014 98998 8205 89088 84762 29513 60591 54670 53879 95864 69909 57715 94636 43618 10058 73061 82956 36051 90749 90943 53397 37831 69685 46633 91072 93340 37883 15786 52169 48047 20322 86461 67781 86396 59119 43735 10720 84632 71410 27846 30010 2003 99120 51817 82736 58786 92823 89490 17958 74558 96866 69897 92343 65165 27952 38932 22246 21815 64367 74232 1882 20743 88040 64225 42316 36874 46621 87276 10930 59933 27768 51864 76075 36428 62827 83736 86576 85954 2094 70968 40799 65250 28847 2875 24944 78446 4335 63709 25277 56938 60912 67070 43965 57337 85504 41992 73214 50907 60590 6611 7401 2963 54898 90384 97873 65631 80990 90762 80119 32435 61931 75294 27981 28134 74228 65060 14615 32252 59223 60403 84871 59734 20135 94874 68786 47172 46932 28343 90883 18034 36220 15207 54954 25330 98344 8628 9015 95166 68879 86752 20139 19602 66706 11831 13818 72279 65858 58197 57584 45223 73316 70018 93542 30287 29961 34779 49526 93656 76851 83423 83544 16856 54015 53088 41223 2707 23962 73381 30925 69649 37078 62123 46223 82893 81105 41506 90435 95818 81898 10595 82891 62 47627 35121 51623 7745 73631 40485 42179 14255 50103 18939 97228 15036 39795 86845 86656 74825 17923 52990 92837 72760 91482 83855 80772 71808 40125 76804 7773 85946 45824 77125 52389 43535 3483 99839 67254 70320 29697 42253 85552 40501 11843 98158 35782 69301 64688 9630 44511 45483 86708 17365 31800 27241 33301 95490 28998 49908 49076 81778 73583 18920 26421 39218 60744 86468 82521 9864 56390 35283 72024 46907 1262 17986 77536 35914 60863 25439 45138 41156 861 82539 57112 37978 92675 94896 59055 17133 78925 94818 83580 72039 53427 60059 37788 4872 35435 3751 46692 12448 42798 58971 69789 37832 93741 6367 32961 98599 91941 18301 42901 27702 74590 17914 76242 87863 28136 76591 60578 45452 1392 98225 89573 14763 70684 63747 39338 8643 36751 34339 78260 56408 58058 36781 87481 74978 50233 79363 34209 4171 6299 71800 65044 42105 17394 47592 11516 41618 98668 12256 25015 53677 50048 65879 83302 28688 6542 73428 35794 11654 57795 81245 79799 92123 41562 3173 84903 94855 40794 24752 7684 22149 39032 98914 63947 83768 13783 31620 50668 75402 72570 80882 34826 91600 61355 17591 51328 84113 2 21609 77193 1586 24484 11547 74199 71533 40514 31671 17170 10538 18292 44380 50103 73613 83048 1680 37304 78655 81078 94107 1740 66938 25952 523 67781 85577 54589 87236 50522 2903 47879 29860 58884 92685 95545 56385 4659 48141 9932 34861 34709 11662 18409 54152 28494 31209 89067 71199 28120 79294 69414 23223 93092 95511 42738 28297 96964 38524 31837 22751 8071 58481 4798 8814 21529 25760 62518 10963 34694 77014 12645 64389 83260 64427 59638 84035 80199 19142 65622 87636 24712 64773 61738 71203 73391 41966 14664 60383 90770 29922 77999 86135 21471 75836 83200 58165 51102 68181 49757 34545 48128 14780 19295 10967 3874 11594 43285 78061 12871 13182 79057 20216 60712 40745 73809 54343 11619 88715 41278 32021 12909 15813 60786 53451 58532 31519 53334 66670 78889 13882 14428 50458 49099 19629 8338 4367 32917 72486 53469 94323 4477 40660 53532 27227 15061 39423 54198 53003 97072 19729 29940 17517 22401 28803 30725 14823 57377 53641 43266 12150 81490 83357 46507 46094 62060 51316 66039 13426 2066 42990 57122 4977 3296 80470 71015 56021 12016 19584 84291 11602 39356 20543 95825 30237 73579 78058 21152 74438 26442 21878 38871 61487 80815 23665 68786 72904 31772 71156 86478 46040 38311 95554 3986 96240 27918 63069 71290 43012 21144 66569 78283 38627 68390 78253 61917 22611 16091 49308 48218 50546 44473 67469 83839 70625 44090 8427 36868 46404 23312 42028 71549 49170 63954 79189 26618 68395 67248 70476 51952 13675 57325 92278 83184 6621 34407 81521 59016 86129 94893 4847 10884 75458 60531 73212 79672 84573 83851 37825 39169 46171 22067 28372 30954 8840 96609 19470 40387 35783 80502 36272 68408 82549 80753 35177 78815 52196 7951 20567 25732 51346 50258 83529 90926 95549 93988 73472 85682 37399 57948 38605 96915 15845 33738 96192 82212 50134 49204 18532 43474 26812 97209 45602 33879 53235 96933 60291 77812 76021 79878 87178 8489 87880 17769 772 52931 71257 34530 54173 18997 52236 69540 64076 64149 63130 84339 13054 50651 37201 29979 55075 16872 83948 17210 35172 19397 18396 56682 59211 25621 42831 61359 74698 61522 4408 28321 48555 44299 77079 42153 52804 54555 41279 67104 94108 27723 59790 20195 48086 69415 73251 42486 84359 24388 63723 10659 93250 53808 59760 56132 50088 500 81423 83875 78040 46880 48673 8123 95421 95243 1580 47169 58414 25108 5785 44425 35134 7301 41652 7945 71979 79457 557 85589 38208 12640 36730 18022 59670 23770 48114 36724 77637 13523 84654 99221 93673 34423 7479 78697 86475 18786 47383 50199 11616 21221 36074 40602 20149 55364 8608 34538 56987 29544 455 53467 25009 11060 87625 50078 25823 73752 43309 85214 13133 8573 9448 79503 19634 1825 6693 56875 43384 10767 31175 22179 4585 91268 11528 40048 8712 57200 24610 7239 76926 76257 93342 35608 29710 31890 15126 87918 34668 6037 94259 33671 54418 62346 76786 17141 55520 34572 11243 54804 64380 49836 83705 4356 81060 41440 593 72486 86944 30913 17672 53622 7173 83988 38679 16814 13822 70188 32014 82946 80723 80722 38940 59474 25892 84353 71716 24867 2489 25962 25122 79943 24253 97455 49786 8290 36341 35738 60775 12952 67527 27419 79873 21577 24670 24940 34989 77202 15420 3822 65132 56879 10070 15712 4390 85317 78521 16915 43347 35725 63265 77106 91384 35061 74359 97899 88293 15854 17290 95976 38644 81797 89707 30446 67352 79303 7921 79131 19857 92197 49139 93473 55386 1745 20353 86729 6712 79204 89830 35166 4851 3073 42132 96927 92146 18243 42615 78255 72161 79232 22333 1780 69833 44681 19292 56533 312 15314 36991 34391 69931 32540 6178 82634 57744 79886 60778 27305 51067 54454 63909 47053 33460 579 44937 2161 48586 22885 33502 48423 88391 20923 1457 90589 79037 12580 48653 55035 63019 38436 93508 86361 922 64283 54298 97612 41237 23955 32114 28785 31683 69697 31410 93336 70471 22226 79089 17356 20946 37695 28061 1116 38045 33737 56213 57655 80012 41778 96723 8116 3800 77807 60664 38497 67603 48790 37823 47526 88958 36919 86693 40328 31848 28876 49548 47585 21244 82308 53562 74874 8531 46694 83899 11858 36247 80796 39714 56042 75579 33876 8998 30755 35045 82877 23211 2065 63809 42739 77640 24306 98063 92056 28409 68902 23913 81246 2099 16186 55199 15432 78889 14887 49707 29216 35182 38987 12185 95534 56635 96626 57620 35785 57535 70742 33206 23410 67467 96145 22437 98120 71197 2696 79770 32958 12719 79292 69291 21375 99402 38335 5821 76517 67167 85382 21903 59906 92640 23653 9107 81700 63213 48096 7080 39730 40955 8680 38800 89481 81309 47629 15450 62235 92504 40253 59360 73529 46641 94092 18459 89144 78360 86042 70656 40796 32058 42156 41612 8724 43566 89818 84326 13354 67249 36953 93966 83246 84442 57985 56403 91479 54178 91222 53868 77698 92137 77345 76177 97984 88757 93711 10955 69745 2437 64127 11312 3813 88781 48822 64387 40939 51815 44258 9216 34869 28106 47512 77347 49183 39741 64885 54656 60103 77078 69440 87779 82437 97232 37154 83625 60853 49211 16367 75380 93684 61659 10227 53462 81424 54124 76801 84845 17137 57804 76558 69214 60928 56709 21899 5357 65703 85159 8420 66261 46369 42574 32614 6330 9692 11486 25672 49174 86978 89710 58094 29399 36778 72617 94786 86838 9800 46431 5330 36666 93212 78514 59121 63821 76531 15546 60053 15190 6279 25569 444 87983 21600 44795 38885 37730 88014 15161 31706 54353 71511 23523 72738 79736 20158 78461 21065 65238 45422 85614 21457 92590 20373 7486 47157 6597 36986 18668 19725 33104 89699 92402 85621 80651 77436 79432 54208 49254 41269 65081 26875 94757 79919 15481 71955 22180 10267 48907 25135 6521 65084 93144 20043 64423 45141 14825 78691 25167 67917 31686 16480 74417 80061 43654 41430 69153 25826 43738 52351 47237 88634 94632 65610 80040 47981 81978 25216 41583 18861 80230 75881 92607 65894 92055 3761 3030 9350 47200 74562 61219 65258 71776 23693 43513 86778 63884 78162 42444 99035 36530 14891 77076 44598 13764 85154 33922 81788 90971 59804 11859 3006 95271 74999 69481 65270 6946 83097 98341 50146 27841 38419 70501 95257 7676 72555 33837 64572 64211 38919 53538 49638 58185 31223 23233 18965 8986 5564 94183 57745 61979 60814 95982 65084 43432 56999 47189 946 63976 76350 79348 99986 56538 56724 22827 94475 59687 52065 27895 13482 82320 99617 19512 50522 10645 98550 9229 16848 43373 29708 12667 22567 66083 71154 45992 52787 676 89202 99839 30964 90866 9631 14105 86643 9649 98752 2069 69783 99671 9039 97258 78855 82456 68984 21507 94889 97412 21890 97651 38674 56561 43268 55278 93283 25928 91543 2991 59121 69530 71743 65604 33683 16903 16862 9729 33199 40089 16592 6166 98367 51053 48103 2557 51354 55427 88561 4725 96253 23554 14071 90146 80184 64749 14737 1986 57234 15719 80516 97140 22404 79085 37569 46717 7772 72932 39779 12399 58051 77340 45141 47117 27725 88821 31695 93488 66953 18603 32700 78432 88437 95698 95737 27425 32430 60698 95421 46821 72075 61227 54416 47667 26265 84991 52438 9475 72212 91363 27932 7356 74908 27443 2114 50984 75666 39526 80067 8808 6938 15918 8567 15955 25582 22035 95341 89261 81777 13732 19439 97876 65772 39782 87402 62860 99648 69463 14922 84236 66299 6169 38680 18905 92789 73004 88035 57892 30312 81281 71284 76337 97908 17867 56140 54684 82136 12319 49151 94490 9901 69736 3722 77307 36602 80279 11443 40071 16809 41278 56407 65422 49638 52884 37197 10412 16029 73190 86241 22026 50100 43759 41221 12958 11775 21508 48210 96073 52865 77865 1246 1008 93793 51161 48013 21333 53159 63174 16323 65712 97314 35776 41088 11516 2149 68606 96469 84307 44273 63731 62883 11638 63777 8201 83568 24614 65764 50462 90380 5635 52842 31552 3519 5777 5755 57016 34870 80233 54345 20487 49637 15260 6045 14857 65975 45066 24065 91994 97294 82081 72481 56919 66922 9038 70402 7404 49825 6313 22410 54912 21064 12949 17458 87821 15674 44820 13401 62876 29660 18352 49377 35798 16792 53253 53194 66987 60890 52679 35930 63270 28283 84289 90922 41610 30133 10603 39348 25734 49308 42125 89564 11604 11492 11655 2411 62675 5229 93222 79659 20877 80565 14096 17784 44252 81008 33292 94267 7193 88466 85028 78600 24219 85859 10547 85181 83221 67105 26767 10300 99114 49142 5183 20386 23845 65704 59455 83716 73681 47512 65131 62768 59718 18578 59931 9406 32555 63319 98042 30082 77063 44151 56846 13246 18188 74259 19534 36154 23731 75236 82032 93256 15032 74266 57681 13350 21507 20553 78115 57697 39966 25665 13757 16281 84659 57505 62390 44399 38976 42570 79228 6768 44749 56204 46930 21348 90087 5531 8993 20049 81684 34739 14958 68526 12540 7432 50877 12244 61022 45703 53463 40994 82222 30645 31374 89063 77525 93966 42065 13227 53348 55418 97638 15769 4967 85697 98138 4702 86388 99534 15727 8387 52185 8640 78171 86733 82249 89205 25090 6166 25386 43635 35387 70557 22702 61216 49317 25291 96702 7391 33613 76670 17063 96333 63125 93840 78992 26514 17393 85414 55126 83944 15602 68001 6900 42775 38357 68811 66335 17959 9703 29528 24158 49637 37842 3649 85221 23960 37983 64454 77138 60024 85751 65820 23079 17599 74600 23049 14665 5352 75677 5905 45897 94245 23550 61038 94060 65795 76267 6008 58535 49885 23160 62055 93457 31812 38842 17845 95159 33268 6834 41354 30346 96921 61260 82079 15915 29310 20041 30777 86386 81720 8037 28905 9862 73736 93560 44957 38458 89162 86712 59884 4151 98983 72969 28782 95967 91078 80464 11035 79456 11345 4392 86108 44397 45951 36983 97165 91651 99374 76486 89716 95121 47940 13582 37459 99742 73528 18687 72527 41448 7150 78566 62312 45 37068 55700 59 20933 61160 68850 1418 66616 88208 18243 24141 83930 17795 3827 53106 97933 53512 10036 17872 68396 29145 55484 34924 69823 52544 31048 91833 80948 96847 74766 15476 94641 93766 56985 91547 84164 8601 74201 27508 86704 1686 75034 76193 90142 5946 66760 62244 33967 75255 75855 78562 60301 83284 60976 44970 75951 77520 1822 46270 11437 18154 12313 91875 87929 56516 51519 64221 28030 32753 30783 48131 71350 97421 40476 58317 80794 86711 44811 7231 50521 5950 18168 80416 51487 1115 21354 11579 75536 23004 41251 74547 63959 13782 42268 34318 31458 70570 3059 24368 21464 65781 36923 42424 53743 28869 19343 81878 50211 19208 71075 41035 49927 44754 70264 77379 49168 6210 91979 99044 27551 71357 98639 10686 46118 9256 29755 55928 28340 38992 64425 23586 59963 72663 55012 9838 68638 57296 55468 53552 69279 45369 92708 86935 86080 48637 54495 68705 87123 54953 92270 91973 92529 12753 62352 84018 42082 12914 53962 40140 33252 22657 77499 58786 65583 51191 11502 70137 52349 51782 31752 75330 85446 89937 70927 38521 64435 32382 82274 98962 25689 36541 5712 95286 32569 45177 59820 19192 12580 15906 8139 40701 52431 40255 73226 72194 86946 31967 96908 63396 42757 89219 70153 44514 22724 60468 81013 59698 42013 68584 54077 58030 51769 72983 79852 34214 11329 74428 57535 36164 94906 92194 99596 81672 43678 68288 71614 51346 99234 78406 65808 50004 79301 54312 31695 53718 81686 47331 12310 84681 27394 87651 59442 81102 78827 19102 26297 54302 94033 14116 61050 50207 2913 98553 49709 57425 16354 41070 81732 29090 4194 86737 36842 10661 2985 39576 16463 90870 39469 23707 68223 18000 80722 77803 76971 48684 46891 62531 20721 21406 47464 85665 14983 71903 27021 74570 93914 32646 31386 50726 1713 83589 30133 86001 92713 46380 56375 45344 63605 39209 49771 45590 66221 34496 13705 85073 74327 86593 22549 23717 2855 21696 39970 18311 3013 7148 34208 42645 81712 42331 1261 47196 18751 38317 31923 38049 80186 78487 83599 79755 51332 77288 42854 51786 37834 79323 89610 13306 8237 65961 98953 55919 76498 61654 41460 49102 47881 57152 68017 7991 76664 91791 90030 38231 9104 62059 90995 37549 10088 48620 30348 58765 96917 78971 25541 63914 28656 67946 23270 24160 24488 3229 95817 45210 9507 68075 23407 22898 11391 18435 48553 58633 56395 56648 13305 89395 38092 68916 15346 11977 57309 18730 43877 6141 56694 13436 81218 86404 98342 86146 81079 37104 57933 60153 59419 10473 33804 88065 58845 92374 94410 82830 72484 65408 12591 82837 38262 24065 60096 18299 39534 21624 60803 71080 72999 53463 26063 45173 69835 6501 20611 90013 80993 29422 32483 43801 62598 3405 45373 89044 22372 18015 36868 37483 13039 81965 51003 86607 83638 23430 18562 14933 24679 59593 23584 8246 68095 40123 39483 33983 27902 94260 83243 5950 92531 36209 61117 6553 4756 8516 4261 58743 90147 68119 17756 64854 20012 44768 91441 54517 19733 26491 45997 8852 58465 51801 12731 53115 81105 13324 70478 34982 68493 2550 88082 30675 36775 50373 45871 46103 11856 43127 34576 5208 39892 18797 55129 42712 19756 73091 67782 43439 68412 30063 63972 95408 55137 56974 59382 48889 65532 28085 31632 98596 81245 67053 51034 31216 86369 22633 77848 5455 36427 57373 24489 56795 50892 53973 6102 44142 15190 69022 27961 80559 3098 88770 83117 15261 55504 66654 58741 59081 76442 47235 74595 70566 32356 6261 2066 44914 65519 61523 37211 72927 57556 34200 26235 62173 3995 65383 66856 37540 85793 17460 33979 63374 48779 15054 3128 54386 26935 5193 70073 67516 70464 41416 90075 91944 64587 21482 85209 79423 49995 33388 93185 82151 80897 89367 56110 90325 81609 52574 72631 86613 87608 86118 61896 59694 82007 79164 12763 44068 63364 29757 16705 78333 5788 89082 7847 99093 97262 96834 58557 12710 67128 62385 4060 12068 38664 71447 94473 30545 67707 22907 97733 50384 53240 25521 1839 7642 30893 9165 89841 60909 85286 30324 86029 15982 42168 76501 96745 23693 26268 99247 94266 93054 95811 30484 17186 86934 89632 61824 85745 92439 47824 91557 55528 83185 91857 69006 57993 15653 75113 90934 1244 26818 39761 29685 29495 25227 40921 97753 64668 92732 24053 78466 78554 39044 66502 77469 68978 76317 19142 74694 38409 5928 9056 81508 98444 34662 89188 32723 48609 62475 45905 68159 2918 9020 407 83442 62620 71143 64924 54729 58576 28512 39628 67047 11700 39587 61220 935 84911 95097 39096 57067 25014 21243 40064 23559 17974 49775 7526 15635 5998 97167 26069 42342 39869 20052 67409 80011 64981 39118 78618 57133 64492 48649 98568 80358 8050 53896 13546 56289 79523 3468 87958 88765 82167 8928 31070 56322 44672 68793 85726 99516 76535 39102 49968 72797 46168 17762 67512 40620 80218 34853 48006 22484 7501 66070 3007 16581 96008 11503 8624 56751 56417 6934 30754 82421 10539 59841 73858 26218 48155 27301 39205 48954 20656 77965 3526 76650 44947 5313 54024 19310 16035 84362 40655 76110 51752 89014 31646 56709 18043 12247 83160 73355 8254 56313 59074 83483 74865 85151 61776 87485 37102 56194 59943 11348 12862 73754 24233 28841 48400 31179 6816 2934 44195 33969 25694 51154 455 21034 39744 64548 30686 26283 25425 34945 16762 47736 91071 70209 3941 16341 89732 2170 59254 81682 16483 16912 41715 56778 1138 62120 57785 89145 32321 11156 527 50313 73812 88571 95882 60994 59127 86718 4529 94077 75249 28179 52730 22646 71457 53672 90626 5203 54200 40134 1416 25284 53930 78670 9838 27661 74854 67052 63422 18312 63534 96456 84920 20345 57263 37126 19370 3072 98180 52648 24229 26408 24026 97528 76007 67798 71511 77757 91842 23846 53214 79051 89454 3834 93951 92459 33919 57337 37557 92013 44694 3091 60013 44124 61328 51328 49864 53401 91316 36757 41852 74584 88504 4366 14713 45274 35508 15260 89072 19158 28571 64688 86372 4407 88297 29480 34777 36929 44708 87055 32983 43192 70044 73206 7880 72262 57766 70838 26993 1787 71180 46851 51654 47580 10134 79357 41829 31512 69209 42412 48540 87387 85861 40462 54832 9499 1939 9678 51199 73544 87016 28373 56434 84591 96980 3693 19816 31787 66310 26763 65590 54488 57487 13471 65660 49506 15963 73096 51455 74150 4148 71947 882 24765 12820 84212 61317 95439 73431 47200 94573 46577 19718 63164 54772 38023 72072 14903 35069 6426 43102 87303 44159 91522 87820 12041 98506 41042 46897 77612 41236 48908 56427 71871 23623 6425 22621 49295 10111 71150 84892 40129 92816 83115 15750 43615 26422 83115 30953 72495 19446 12720 8344 40971 42766 719 38828 13303 41391 65683 57904 55246 60378 89319 31208 55501 20852 40316 92495 9381 7063 53367 57500 81862 50408 93060 62114 92221 21373 57307 98317 87445 65317 21 46301 96594 43039 77720 26222 83309 62076 49735 18014 38652 9650 86728 22719 81468 23223 67195 63742 58451 59581 66640 51497 61107 48391 69123 59869 1794 41174 55848 87921 16040 91616 50496 5301 83310 28170 25980 4774 83423 4885 2316 10322 30796 41384 90294 14247 53714 87949 60635 41718 10800 76637 43329 66188 61884 44372 86830 24142 35455 38939 31805 2586 59877 43838 79123 97734 50569 82911 56766 68319 70323 90704 15357 31982 4958 59473 6985 78144 21496 98807 27020 95845 1035 68767 23607 39939 63528 72516 4517 84119 26640 19342 96052 34194 65870 94041 33691 52 68134 93579 89158 49757 95998 16981 63602 94212 4729 19375 1585 75824 79380 66136 5548 59608 84074 48068 55461 50178 40685 43555 63334 83049 79097 38622 17279 63689 26241 40846 94804 52770 26082 48052 50047 21047 7750 57729 4608 22295 44011 28108 96689 57761 67248 26838 68226 30552 35151 28199 94688 13399 63312 44780 87245 78245 66885 4578 21987 61079 78528 9437 75878 60468 34799 35771 74139 93212 48195 63520 78742 55572 7023 44253 72705 63496 70291 44378 19877 70287 49810 24382 4899 85155 96681 40047 83023 41080 34377 76574 94490 85433 5580 51558 23141 91783 24988 47740 3951 16338 55260 61492 9186 47451 48292 77956 67853 21629 19016 8782 98136 4484 43907 53402 57518 60062 1376 69772 40257 56993 96258 65535 76916 84885 35558 45518 15632 79420 47661 76523 89811 79572 62184 55342 1934 65398 92659 90922 78165 49823 89241 36640 73449 22876 53612 33606 31781 71801 33292 50937 31346 25483 37525 33949 69202 96628 41936 96187 65206 20142 74143 16250 89863 11125 97519 25332 45792 90945 35280 96420 57488 54805 2095 71104 49074 79261 35407 84904 14735 93112 43638 77083 11502 60110 13490 95865 29100 46921 43502 34999 16527 74779 96074 62612 70060 78271 85131 28285 12378 19685 41619 59283 17478 32363 24022 81888 61085 91497 66086 28768 1242 35801 78935 18316 18751 88501 49773 16897 72174 51082 4353 19948 47074 68219 25403 12862 4171 87343 44196 97589 56124 61273 47455 95903 27605 67348 66777 65268 78366 41505 42756 88233 93975 50732 81016 21302 73929 52342 42311 14220 71801 13495 33903 35595 67136 89416 94394 65816 73773 83742 89205 43191 14273 39429 58881 74238 15154 33674 87427 44085 2612 75270 82837 87896 3420 27837 87028 9273 80688 7383 57351 56572 59169 27604 86875 93057 19819 91385 55623 21852 68261 51925 29959 51603 6881 91932 52300 13807 65218 94318 88354 67740 68334 2837 24061 53916 47876 96106 29428 82020 25488 23435 31453 64252 23281 75916 63305 30020 81035 91203 81978 82912 84837 15418 71573 85898 36818 70627 74428 85690 20705 1317 17250 12197 42853 98316 24471 14015 53452 23594 35989 15898 77606 84373 71489 9125 10949 30002 8543 10728 59515 70011 66659 52498 28519 36805 14475 85714 89763 41418 42293 12533 82336 95772 67120 79983 26303 99878 62426 97480 54073 17417 29792 63825 89128 88135 54644 14615 26801 50493 13250 25990 96798 73011 23179 35677 12137 17734 54405 67248 34212 84275 43238 68542 8644 7848 76283 188 51632 9757 36594 35155 91474 23755 29235 55281 94954 46719 28417 55710 33276 87085 13401 93176 67237 9468 85365 39077 56334 98916 82414 23261 21469 93227 34916 79486 15973 56769 28368 28464 84598 94249 65957 59452 15204 27849 48026 96308 12798 86187 10617 58960 50624 78534 90281 56220 77998 52710 7354 70889 89562 60123 84867 23078 85655 76368 45294 22696 78481 50826 52319 47024 23773 83713 89810 4342 82623 54003 95186 69512 43182 46665 89366 2478 56910 52661 70491 85616 69059 40127 63598 40866 48090 20192 43442 12585 43699 55854 72649 27066 28139 87369 22391 64646 542 72571 67760 5361 58905 65585 75048 34059 69446 82339 23101 15939 88010 26347 25942 78424 13210 73172 48859 60325 75997 37019 35128 14231 95345 67903 85574 73053 54729 52811 58151 16669 79101 19307 79726 99604 17036 65023 87259 25681 57739 61459 40567 80582 37614 5539 73857 58263 16055 17359 78213 42143 25176 7566 32227 27026 23150 62797 22972 92676 5847 22628 24481 64995 56460 46466 25940 25732 37813 93809 26776 56668 57024 66336 40826 29206 57222 85242 76775 75317 16008 2267 87048 762 55330 67855 2355 26544 92482 4877 94060 69517 86899 61360 31573 98088 62440 40658 26946 23968 9849 32498 83871 15877 99074 93346 93250 46174 56150 49528 42542 6331 84299 21536 31065 52185 33977 92972 8438 64922 51523 72550 78367 38719 61108 22607 34932 30976 59676 52554 23602 36095 29565 705 44128 68724 98479 52925 37524 67412 1522 71527 24323 54614 24967 32868 86277 13978 36447 97065 8717 70859 31266 58284 25733 86989 49504 49033 35377 5246 43615 96888 77077 5461 1198 57111 88442 57190 52637 69572 83646 80407 18278 13436 20589 50035 74865 58028 49010 5269 45881 33344 56743 49615 45517 68611 56312 52596 30933 72363 79037 89052 42515 52456 68853 76975 36797 99456 93021 99817 41761 81851 11925 24210 89171 26510 75129 49029 3660 82844 35902 46750 53235 94082 1382 83014 90895 24122 60571 25372 42054 13387 57355 77108 17448 62118 723 97110 56222 64546 29388 91710 28875 42384 72984 89433 54762 51071 77040 34591 13829 57207 83903 60673 57275 10615 86810 29444 46831 59474 99289 46711 77336 81956 7088 90690 62300 32794 94796 13901 87147 28246 64375 4537 59818 17860 87759 18251 13430 16501 60736 16279 40662 95068 50278 70855 64580 53340 52517 23851 75569 23386 3557 9569 89062 76982 10302 77638 3766 35469 93491 76944 65056 5487 60128 86528 63240 89027 47496 4403 21363 41244 5939 30213 52263 74443 12600 2674 89544 31718 33306 77748 22164 78638 74779 58465 87327 86443 94379 12354 1355 5189 59539 37399 33250 50259 74106 62475 50602 50699 13756 93189 92562 32807 37687 39076 49547 37410 68760 83071 54370 94273 59290 79208 14486 2072 84671 89482 40039 87377 32010 95802 47391 41063 75985 47989 42838 55617 59079 33732 16179 11749 18412 81472 98841 87761 26328 32115 66242 90108 36957 40549 89076 28588 55899 92868 63216 84596 75261 50262 72918 45884 41202 55509 67006 6261 46186 62997 52744 53677 63132 78219 37059 95114 63648 17676 69828 91737 87525 25138 68889 2741 55704 5175 31491 61314 43871 59925 61847 31177 58892 40012 69496 17128 85272 45564 18148 28019 93811 38272 29703 15619 29661 50413 73142 37793 21962 1790 92960 19431 82251 60514 56841 9573 83828 8577 27257 58158 39258 98143 86685 60846 18217 9502 71120 45336 72851 46620 91576 97633 62843 31223 48265 51685 97373 81359 67141 90850 36164 85364 13490 34600 16794 7177 62262 8932 466 83945 29829 23896 53425 1843 96850 6697 6202 61063 76947 63797 57882 65890 10861 70460 17575 822 90789 11179 290 78661 44579 19408 19376 71510 34481 90064 42751 60623 50133 63209 5069 66033 474 2362 93050 41913 34271 15884 46126 48589 43946 94860 39619 37151 32389 65924 42615 7603 47450 82467 67745 26486 13795 2654 55035 14905 16810 27705 57035 42909 18242 98855 17401 91157 8272 76454 60122 65801 23694 49627 31581 77537 86901 49940 62631 20743 45355 67507 42882 13665 16233 92978 24385 85565 65938 33839 96887 21785 79165 78468 1870 2657 97193 6387 77536 97196 30114 68133 51944 97519 72674 83205 26470 4925 78408 29512 16798 3567 71769 22756 43608 82666 2936 9205 90167 93190 74972 20273 68992 49952 98049 62360 64792 15049 50401 40381 45864 23589 50706 38421 61129 37639 71579 5964 65009 39335 48872 23116 37313 99089 66454 43280 90338 79828 21170 36701 80363 63215 97670 83331 65723 8767 7775 88451 78651 81832 74095 19477 3084 11342 62564 87404 75607 63299 93591 21307 51728 40912 86516 9352 4681 47334 17042 4750 48927 71937 92359 20083 5556 86059 73620 58451 51764 59157 469 54873 21608 31312 97314 26380 50211 3019 66017 54230 78615 28197 94704 46703 61467 21362 37371 55884 44720 14892 43981 46901 5547 27340 45738 43031 71643 28702 25222 95132 62115 13609 26071 48822 17138 18361 81913 7853 8569 42750 69209 17110 48707 62595 13724 13684 39381 43953 5283 19439 28561 94916 530 73528 66678 15946 18357 28286 79831 34685 57688 56936 2084 36172 92332 46554 34026 24412 22556 74724 19797 76224 88094 93316 59747 73315 72268 67842 935 23518 51909 45804 72647 7119 72762 52490 59116 9227 55074 37652 26642 24114 59044 21487 47293 42461 64816 13389 86373 57461 46721 1883 45846 50696 46438 39184 80913 43745 74770 68833 31909 26450 96720 69830 38733 97777 79559 15710 29967 80218 8565 71996 3910 93656 127 80472 43680 99651 66900 3711 33589 52065 14700 28283 68978 14981 75822 50111 76693 33832 8471 90375 88395 70706 16998 15432 33886 39732 72620 59170 46650 3517 39314 71247 98779 16542 34586 39642 7489 26478 79772 60962 80399 69346 19595 56940 91770 19457 15637 60559 6891 80089 43429 20250 96794 25805 47839 95585 10487 32384 36452 42917 96897 55282 15621 14397 93710 42563 98884 18808 25283 93244 42434 17652 76840 96985 87321 54930 37110 16067 13088 44050 26622 95589 32511 60300 53825 12828 82150 12328 66229 1698 88379 91060 88754 13236 13595 19500 66472 98075 12296 51844 53933 21811 51699 95349 18260 49230 76607 53394 48197 58313 23192 13169 86312 69968 11400 26432 26515 4420 70652 56762 44118 200 78534 91771 50576 56665 17161 43673 90149 85996 76910 86687 20624 85605 62195 4686 45321 66887 78993 47534 88547 1260 8778 19566 31701 69425 98588 48612 52207 24788 21877 9051 32470 6980 89864 97283 31034 66414 18054 83095 33138 85804 77624 85338 22855 9613 86361 45357 43998 17328 18832 96617 41983 1538 40489 53949 3841 36721 95383 70873 38554 49699 2171 38420 64917 27691 38129 23892 99109 24893 15823 73007 59146 53544 82153 23857 28434 70386 94447 6121 45576 94486 53290 23968 12645 17337 96780 46092 39097 91180 85901 51308 63521 6486 35691 3159 20402 94545 71900 51958 44095 16076 17827 87715 27195 21819 41020 92370 75485 96036 14518 64797 26656 18856 72344 16979 24983 8411 63917 64830 69147 28688 37076 62071 75389 74043 4407 50617 23180 66320 72561 25902 75600 25495 39242 40584 91619 99797 87563 95064 72443 66239 32450 88267 9148 37497 98786 27102 23760 36076 35980 18062 20981 21693 98650 89382 92749 82826 48102 17210 42818 28356 54309 54208 23543 40250 3052 84043 2062 73208 37931 50188 98055 12232 91932 32476 60277 24029 88218 69852 74052 63210 14862 52747 16899 19208 3179 33522 4503 14855 64372 28412 94197 92554 64154 9422 38156 48998 40055 9585 3484 4345 91088 90054 1381 16816 94466 42432 92580 78634 29056 24807 61247 54254 10266 54910 74518 46806 66032 8832 69869 3710 8623 98763 37510 97379 81917 28153 89984 41963 88864 47764 36156 32063 28809 61036 1793 14354 99365 52203 63905 28060 42528 35607 91046 75211 39709 49634 6764 6623 85391 43721 18375 34536 94077 31864 78263 7857 20233 11073 69883 10929 95900 68196 35661 71778 15679 23572 88978 90770 23757 84924 77414 25613 82674 9955 89462 93648 28522 1069 21877 77357 42249 80654 49863 44040 91766 20378 67272 15578 24548 22915 89022 49244 15400 79561 32896 15472 99101 52161 22932 83553 42579 52787 81582 51165 36348 19615 2820 78692 9847 12424 23410 14271 412 76164 34486 20490 30535 46031 669 38694 73121 92475 78884 51816 9413 29600 54068 31686 9285 35365 33966 81753 88584 57052 70194 11148 23214 416 97760 1035 24638 25973 10227 49187 6498 844 12710 3719 97042 79611 19897 21919 77025 12614 91263 15118 47798 5118 20699 65526 59257 75809 22701 25983 52336 88037 82350 38559 95752 52248 61231 32930 21661 23051 76505 90492 89940 39349 95316 85119 35757 80971 11710 36530 80144 40251 98267 37185 8230 31980 49622 38659 44854 90179 60074 8418 82210 25124 2463 92954 39251 39062 496 48193 57498 24056 11734 23135 62980 90397 63393 7648 48963 99023 8177 80366 59174 96371 92313 17614 76194 75117 52983 49314 44726 9226 87332 72796 84397 36760 60254 60456 71814 88875 43132 22203 96539 88448 717 8627 20675 66770 68346 65825 96755 71744 86678 77829 23624 66021 86136 57564 44989 38520 38241 72286 20335 77761 16034 14417 22896 80450 30763 53747 44357 93763 37027 31900 10990 14750 23567 85041 40893 95310 31890 5731 97041 26171 69906 79883 15817 98309 12778 59759 15725 65244 8166 58927 15957 54658 28053 80144 19523 2766 34336 12072 40609 9868 50380 55788 80867 40548 55714 67014 84315 16924 46056 25010 25540 78407 25866 64056 10887 6406 25596 28481 97326 37404 60843 37157 58679 12855 75575 68402 53904 39338 36637 1240 77109 57392 71707 73932 94000 42490 67895 45745 94436 86579 73183 72869 15787 33615 67876 34436 16781 67547 98261 69580 6527 76180 89667 11454 58400 39352 81097 29179 63477 14862 48639 13621 3211 20599 9831 67961 46032 36287 26163 88995 97561 73307 45927 50077 59125 86020 54567 21677 74257 23028 24754 90463 67877 41814 83346 62862 7834 35209 37428 64026 43495 43096 26629 68148 1080 47818 93891 21067 40416 76710 91884 41087 2809 60201 67252 8965 4713 18912 89881 82990 56888 78207 19370 104 13738 33611 25903 48985 82504 15553 7692 26054 47020 26859 72206 10318 85694 51438 73339 18002 88420 57596 21734 22908 2112 44416 10439 53428 59521 4641 23074 2155 71058 2507 16715 9037 84281 89936 96669 3991 40749 9569 25324 19940 84931 58033 32282 12187 4843 7913 17937 45082 9124 11842 67703 31907 70212 37170 19077 38921 88331 4622 48713 89510 55963 29410 71710 29359 27493 88219 70291 38610 23718 60507 94071 1921 25915 17563 99080 72378 39132 57757 17760 90186 29419 11410 77094 42094 64665 63745 7072 72465 13739 69329 6680 81957 83614 56464 59585 74730 99172 44952 16729 40134 55374 25679 87993 79798 96474 75457 10138 16072 1974 5548 83198 42755 84010 67321 92521 4044 25842 63484 58640 12640 16153 38302 82166 42960 58831 45277 75885 60373 62929 15688 1252 72419 42492 76461 51463 12933 80922 90785 48304 95016 39599 19926 44950 93792 15415 29662 51910 44892 76922 89792 28308 69591 33792 40142 5677 62546 19249 21521 36468 3071 90188 95045 84443 75881 74658 98288 99165 12251 21386 11678 41741 87517 31047 33594 54030 35863 73962 87580 88504 68338 23900 10138 40919 5024 62690 92513 53032 57305 35314 74929 77502 21172 60185 16702 22201 67501 24274 90660 16098 40241 17804 75332 63921 98446 88171 43317 81764 63096 17794 69286 30852 54643 55581 6052 91627 32208 56691 2139 45360 70388 10287 59299 55470 34585 59966 53400 65731 40821 46550 67140 57572 10953 27928 8004 33632 59236 55636 9922 19790 71183 12866 42053 2820 60630 43584 73128 45897 15975 27454 64811 49104 71509 80239 92488 47166 64783 84395 16944 61557 65947 79513 55351 49208 89999 67321 25013 14974 27884 10920 58301 80058 57377 32944 12216 23586 19686 42341 21022 39508 72719 44448 65379 76021 56947 14053 56418 49697 34801 36143 58200 51510 89545 44000 96981 86943 94554 9362 30742 17357 88946 64314 77404 94832 20493 59608 25173 7639 41759 89095 73451 78552 70396 34956 77756 83176 49539 13428 97074 80482 69236 25697 67098 72738 34846 43660 47780 37023 93357 85237 18637 95505 53544 58921 20248 16687 60910 82251 65384 64781 13360 3902 68197 39433 28525 84074 64919 72952 98688 12872 24501 77254 94246 71354 72629 57698 1642 64956 77559 36008 6708 83950 71203 49456 59360 70657 3910 18511 80570 98077 56373 127 97564 89630 57103 68867 18189 34709 78906 93040 80359 79706 12808 98056 37555 99227 42848 34162 66288 77162 70193 90772 6470 52313 60012 24559 70641 8249 9531 93506 82975 12102 60725 14105 34007 31962 6074 83882 62030 87582 60819 36447 97077 14066 167 21246 28447 43238 84870 25213 81702 32367 23619 78499 16068 94953 45694 11474 78194 13238 82312 55184 73191 37157 80088 2453 38887 99390 95079 71820 34256 1225 40821 41490 77933 48898 88812 45494 97770 45122 44876 49247 77363 65470 49836 46687 10489 74309 77946 46177 99391 59977 31519 37371 57847 93884 55173 56225 4965 43221 18148 90336 60635 91983 38137 91799 78577 49961 45039 89780 77932 54429 8107 19973 59314 94184 74906 13146 16284 10633 95525 9953 78163 55632 30480 94205 45134 10737 65751 61785 1566 97574 83376 67394 18499 34014 61057 16317 81226 15827 99207 93400 2907 28520 98867 46412 10161 19033 38955 65998 11566 81989 26250 29402 85007 40181 16585 137 44804 23983 30660 810 74575 79379 12917 1274 36743 59288 6932 89301 94655 77880 45737 15960 8228 32567 80524 32896 89070 23355 96168 63679 26010 24253 87003 76436 16980 86413 91287 49931 68175 77702 7796 50290 46441 88380 42990 60567 95822 57588 62175 30316 54203 318 43113 37381 30993 39556 55505 79073 31771 73299 14796 34936 40854 31113 83730 68279 97704 99933 20099 58661 28125 23786 94120 82528 16176 7134 23876 84178 27756 76510 2263 4245 21774 80148 13882 57893 9862 30286 65303 79900 50558 17829 77150 78829 88898 54073 11437 67467 77362 19155 32601 61716 39093 21939 25656 65138 59353 1008 19917 81322 16126 21460 91733 21279 85830 47194 44652 98041 85056 93367 90472 25648 34284 88719 79605 64731 54505 2445 54196 81849 32699 15308 22433 14797 17085 39679 77488 61046 28108 18185 9520 31528 96076 55660 84187 36925 61399 64090 86095 98682 98361 25224 50629 1902 48368 556 32598 32326 73601 43355 85137 64588 67023 92433 47296 93916 79665 52336 63764 28494 51141 89657 85153 84637 54314 141 22289 52000 90071 26281 52945 20987 93124 30091 4453 89557 34789 50740 60629 91613 33672 1744 66456 14156 10205 87381 28957 95401 45963 43051 37696 21033 33711 29232 53347 60804 29107 33750 37764 12634 39996 62028 23998 46435 14254 20017 49685 64822 12090 19485 2259 22901 73770 60362 49410 74341 18677 69819 53242 35887 36668 2778 91555 87528 57644 33527 34694 50494 10287 93143 51402 10270 5890 32402 42113 76823 8223 14863 23131 99217 75377 69814 10113 76813 84507 59773 74318 34243 75436 42226 70042 52328 74035 30286 56678 72157 81326 81974 63852 14487 39249 72792 73053 81664 9029 31288 14212 34256 23067 42302 656 59576 96315 47565 50878 74284 8058 98354 70565 28271 90040 39890 93310 1984 81879 32154 3462 14408 39704 36817 89537 83873 8949 24978 1630 8883 97253 85382 11277 61155 8382 37821 97189 8045 23136 81387 5304 6562 38162 32294 56593 36152 98609 30916 1060 62433 85580 22773 41368 49085 44291 43111 74531 60057 63907 59797 25111 19309 44963 54194 68357 20252 15327 44717 66723 2083 80632 82745 68202 35206 20118 75594 39910 82920 63827 16219 35371 31563 12076 24348 18919 6301 83159 28725 95677 14754 202 45156 20533 85633 53124 30045 84559 94590 96626 14101 2312 94460 70157 45911 48447 92090 50789 68 17087 38926 74938 29527 2382 27573 89873 66897 23700 11485 20946 4340 43881 89995 65481 6777 53997 25861 49263 38070 23055 87526 6563 4896 36072 33260 69630 47974 68976 79397 78601 35343 73755 19831 47752 37380 72296 88978 49036 88248 82359 85376 98850 63451 24111 98119 58948 28191 80668 3312 87469 36215 11079 22731 984 83840 39182 61880 33530 48834 66789 69626 3542 68857 84610 86609 24638 39132 79379 74603 21194 34045 60606 44026 34632 82363 55397 21781 31374 50743 44771 26614 48393 15240 39927 44185 37301 25479 21885 19027 92900 91203 92948 5588 77161 45863 13408 45547 74530 66947 21957 63586 39537 57742 63215 98800 22616 20195 70834 13947 85089 73593 79594 49712 39251 98716 64958 16185 74484 12174 33484 38722 55345 605 12576 403 2571 69423 12970 48244 92923 85805 62421 55378 38819 20605 34021 56376 33688 18877 17576 97896 73989 53709 7490 71861 93820 43028 5593 23335 73068 34100 62347 50300 5032 85379 4862 37508 34448 415 25177 91611 1876 93496 27224 69742 55355 91714 55922 18742 15297 3155 56842 67219 3528 5874 39871 37628 72437 37372 45317 70556 95151 89241 35901 78405 2691 36674 63054 70650 79030 57528 80975 17873 50009 20622 6881 46754 27025 47962 50878 83201 91454 80583 63913 85820 30727 2684 77213 36894 62006 3758 31676 83081 4393 83397 20640 42997 85614 28453 94465 23889 94117 17262 371 14566 12505 30599 55969 46802 93269 74053 79913 42369 62733 41531 28133 87915 64168 74546 9055 4851 75991 97008 76278 6452 66014 30177 22117 59347 67658 17490 20469 91598 89071 13933 92435 14540 91110 19655 93128 50586 95090 62504 43111 84171 6270 59179 52906 78033 63993 9681 13999 22006 54418 4756 54796 6527 46802 51006 84949 38038 39238 43373 76503 38461 24819 39666 55299 95955 14131 16831 1062 59120 75054 13645 79621 91849 75764 89521 55701 31016 41909 54122 59707 14175 63877 47448 6962 69476 15101 75119 92814 84965 67336 28501 12067 99477 13847 44400 76158 82287 36441 83979 26535 93729 77291 35617 67654 43954 1476 71364 68049 92017 61186 11712 2906 52490 97520 78345 36574 1781 40822 39564 68456 1339 95493 78088 90723 79955 20206 35887 31270 42321 39471 15766 80375 96052 47490 44376 24481 14351 90230 26326 35543 76502 36655 44111 89385 53394 75061 83517 11490 30235 95438 89203 73678 83678 43815 80158 90094 55517 59508 79690 85953 90157 31217 39669 37472 28040 32905 63688 6439 72217 25412 58839 17839 70251 34711 70789 53993 78641 42776 81848 63631 1946 51982 76709 9346 23818 8969 5548 1869 72100 98930libclaw-1.7.4/examples/avl/test_files/tree/arb_set_1000_1000066400000000000000000000114421216507631600230730ustar00rootroot00000000000000 8522 8890 9112 1595 708 1377 931 5568 4737 1335 4638 8045 8669 7849 7138 8466 1745 4870 4396 5202 6033 1304 1250 1488 463 3059 1034 429 226 1907 9239 169 6992 8487 7922 2821 7947 9305 90 3250 4074 80 5771 6305 693 257 3990 3592 5685 6059 7380 3376 3410 1899 8631 9721 4749 2510 508 9446 6273 631 3650 7997 3979 7587 8869 7830 9586 6627 3180 5403 9841 1333 1254 5351 1812 3974 6542 2969 9642 1130 8773 8566 721 6433 7045 9808 1750 2775 233 625 7673 8822 8928 7790 8929 7177 5630 8752 5014 4035 2412 6831 4804 2682 7770 2350 6611 5671 6887 814 3454 3023 2016 1728 1496 6301 2218 4130 2125 893 4158 7461 650 1354 8184 8844 7070 7146 6411 370 6901 8626 2028 2494 2512 5619 1536 2124 7955 3420 4150 6503 2739 3581 5082 6474 2544 9305 1908 5225 7313 7811 5763 1106 9709 4504 1557 5612 9412 6294 3951 124 1197 3907 8302 7507 7296 5543 8295 7153 6989 6705 4488 4564 8898 3556 474 9072 3958 9653 5904 5787 9533 8381 8059 366 7638 5957 6218 7701 2745 2323 5517 8111 7134 9788 9537 7144 4266 1761 3327 7573 3142 6411 1087 4685 9111 2604 5228 8447 9110 7958 6025 8667 1788 1362 3590 1706 5505 4804 6372 9876 9642 1843 2912 7082 7226 2585 6069 6831 9315 7483 1438 1175 4123 4834 4166 1707 6342 9289 908 6181 4653 1241 6123 6871 7862 9418 4429 9245 2659 1540 3251 2057 8456 372 2466 2448 7267 5022 266 2155 9116 9828 6968 3408 5920 5672 974 5629 9335 1080 3614 6508 524 2928 2080 3562 2317 9120 2181 4759 6730 8069 5122 9321 3321 2332 5042 2274 6334 6230 6525 8855 1124 9819 3789 7374 2806 4033 5793 1606 2614 4353 3973 6324 9939 2852 1811 2059 499 946 7983 7681 3631 7701 7280 1902 4153 1051 6036 7280 6784 1743 1276 2830 3576 2388 5302 3836 7332 6428 9936 9951 6486 4390 7146 5178 9396 7253 5260 5837 8536 9279 2503 5099 7554 5152 2054 5189 6649 8765 5373 845 4255 3505 2980 132 5488 6370 4440 1210 334 776 1744 6129 7039 5379 2823 5275 8673 8774 4404 8528 3335 2409 5939 1759 975 6542 8804 9728 2288 6615 7509 9002 7666 9862 2129 6972 6658 4509 3669 5568 925 6402 6594 766 6141 414 5227 1477 831 6469 3251 3920 2585 2532 8022 61 4648 9400 3918 1220 8329 4648 1432 442 9219 5571 1245 9715 7668 3455 4985 640 6501 4038 6891 9640 1444 1497 3111 1303 2212 5794 7838 5957 4757 5750 8014 62 7610 2660 819 523 7813 1819 662 6510 4396 1791 4883 4883 9878 3761 9913 7812 2742 5821 2073 3689 6377 9534 9762 4928 2439 8614 6236 8739 9103 2073 4706 9477 7180 6663 9961 3653 9561 5988 3249 1211 1961 6091 9630 9156 5430 9890 9513 6124 3604 5294 8607 9004 154 4338 2993 5182 4415 3199 8547 6523 5655 5413 6424 3675 8957 3156 8826 1779 8178 3921 1775 1202 3957 2443 4101 9367 7248 211 4374 2276 1328 7407 9994 6835 7768 4630 5154 7552 4325 4226 6903 3722 5228 3594 1021 5682 6822 5292 1930 1228 4047 1290 3353 5800 5711 1227 8945 2508 9037 6996 4618 622 6436 8517 6765 3587 9995 8034 3123 181 1637 2776 5468 4905 9417 8342 5886 6181 2936 7629 821 3485 3334 2675 9627 6974 5831 9229 6842 5726 5283 6427 9895 3171 7729 6387 6482 820 3392 1083 8310 3870 9098 6340 437 4796 598 5290 7935 3510 7742 6135 4075 5187 7986 1560 6773 9354 6203 9641 2502 6324 1252 8590 9390 9592 2292 184 3739 5253 295 9214 6655 2074 2738 8812 36 8279 1931 3979 3617 3664 9965 8180 7302 8132 5733 337 5498 222 1999 2061 2667 1763 2995 7478 1817 7206 5490 484 159 8759 8824 6774 8631 905 1865 494 4523 389 7354 7854 8913 295 6611 2543 3143 9270 82 303 1040 9520 1669 2494 6110 9657 7340 990 5422 992 968 9267 4400 8369 2879 7011 9243 9131 9073 8094 6186 6323 1587 4267 9334 4710 2966 9407 1268 709 325 1663 3167 9843 6945 3352 3636 7780 1899 932 7982 3588 654 9923 2149 6267 2141 2084 8024 8177 234 4726 9346 1430 132 4478 9922 5871 2599 364 8382 9715 1534 3527 6182 6444 2841 3450 8081 4059 5064 3016 6805 5283 4758 7243 6123 9798 2073 3055 9041 2123 4501 9909 354 1216 9272 3651 5253 400 7358 8410 8217 8708 4563 3910 8914 7233 7652 8013 4311 6580 6008 6859 8732 4027 1769 7429 6073 1460 3919 9893 892 7707 4311 9572 7593 1344 6072 857 9430 2572 7375 7949 1540 5265 6045 9736 4728 2773 2953 8670 9224 3584 4687 5985 132 5423 8457 8085 8780 8907 4704 1476 6705 4323 5380 6045 1476 7634 8376 9073 6091 4320 1062 4790 6147 2119 8397 6833 1517 6288 3601 3458 1751 3467 1836 7825 6908 2732 9877 8226 8056 4952 7234 5584 4140 4019 6705 8069 4449 6061 4812 5184 8404 5232 5110 6147 6865 7159 9815 9936 1707 3654 7735 6817 2851 4783 8973 3715 4494 6871 9361 8269 4745 7561 97 8905 5388 1501 565 789 988 2756 4788 9978 9066 2553 4496 644 5555 3431 4278 2688 2256 3406 6775 9597 5517 6242 8397 8899 7853 6412 8524 39 6721 9859 7662 7035 7171 4132 2522 5755 7599 4008 8492 8151 309 1185 2474 8308 1106 9137 1545 7634 4650 6733 5421 9052 4772 6709 3187 2526 1482 7586 7264 6768 8890 125 79 4475 744 1929 1416 927 2823 6260 6895 8307 3894 3684 581 574 9440 7634 7157 6230 4910 7482 1656 8843 7670 5208 7204 7650 9408 4276 3756 3093 3190 1796 3280 4630 1890 7568 9370 667 7230 6113 1749 2954 1113 264 8636 281 3510 7439 2436 8835 3585 2156 6743 9038 3297 916 5091libclaw-1.7.4/examples/avl/test_files/tree/arb_set_100_1000066400000000000000000000006131216507631600230110ustar00rootroot00000000000000 115 417 455 617 104 369 290 409 405 799 208 459 159 85 165 670 233 54 536 828 906 615 199 743 30 760 476 604 217 661 573 887 837 863 459 440 878 789 356 604 982 62 248 472 167 353 102 643 75 765 697 103 754 971 263 54 304 595 320 843 907 573 417 315 56 473 670 216 18 12 297 515 841 254 534 723 433 226 649 605 533 927 937 870 600 977 890 706 926 382 962 268 528 146 584 484 594 731 380 779 558libclaw-1.7.4/examples/avl/test_files/tree/arb_set_100_2000066400000000000000000000006071216507631600230150ustar00rootroot00000000000000 205 636 897 501 139 329 118 640 284 741 727 947 750 774 713 528 612 326 931 221 590 378 968 84 411 503 106 450 30 648 720 43 128 325 608 875 563 535 100 927 690 65 950 831 725 997 337 52 576 554 510 293 813 623 870 111 694 589 553 984 425 317 781 306 76 401 565 46 811 46 528 56 383 178 902 269 31 651 6 255 226 662 742 888 932 722 905 99 294 805 364 942 937 530 394 479 297 480 729 191 641libclaw-1.7.4/examples/avl/test_files/tree/arb_set_10_1000066400000000000000000000000371216507631600227310ustar00rootroot00000000000000 73 8 79 82 48 24 0 86 24 33 38libclaw-1.7.4/examples/avl/test_files/tree/arb_set_10_2000066400000000000000000000000371216507631600227320ustar00rootroot00000000000000 77 73 75 30 4 43 11 83 38 4 20libclaw-1.7.4/examples/avl/test_files/tree/arb_set_10_3000066400000000000000000000000401216507631600227250ustar00rootroot00000000000000 76 22 31 78 28 17 88 62 2 57 37libclaw-1.7.4/examples/avl/test_files/tree/arb_set_10_4000066400000000000000000000000411216507631600227270ustar00rootroot00000000000000 40 87 45 80 74 66 61 11 30 79 51libclaw-1.7.4/examples/avl/test_files/tree/arb_set_10_5000066400000000000000000000000401216507631600227270ustar00rootroot00000000000000 34 60 32 25 83 28 8 89 29 73 80libclaw-1.7.4/examples/avl/test_files/tree/arb_set_10_6000066400000000000000000000000371216507631600227360ustar00rootroot00000000000000 93 73 8 40 0 34 74 70 83 86 80libclaw-1.7.4/examples/avl/test_files/tree/arb_set_10_7000066400000000000000000000000401216507631600227310ustar00rootroot00000000000000 77 56 93 20 44 8 96 35 13 72 11libclaw-1.7.4/examples/avl/test_files/tree/arb_set_10_8000066400000000000000000000000411216507631600227330ustar00rootroot00000000000000 33 83 50 28 57 97 19 19 51 48 63libclaw-1.7.4/examples/avl/test_files/tree/arb_set_10_9000066400000000000000000000000411216507631600227340ustar00rootroot00000000000000 46 46 86 85 19 89 15 11 50 71 15libclaw-1.7.4/examples/avl/test_files/tree/arb_set_50_1000066400000000000000000000002711216507631600227350ustar00rootroot00000000000000 0 61 103 343 486 89 477 144 429 434 16 227 450 243 55 164 188 24 32 4 146 450 485 164 358 286 139 162 268 414 11 0 372 82 133 128 233 126 100 30 179 12 288 143 55 216 186 371 69 33 443libclaw-1.7.4/examples/avl/test_files/tree/custom_12.txt000066400000000000000000000000321216507631600232170ustar00rootroot000000000000008 5 11 3 7 10 12 2 4 6 9 1libclaw-1.7.4/examples/avl/test_files/tree/custom_7.txt000066400000000000000000000000151216507631600231440ustar00rootroot000000000000000 1 3 4 6 2 5libclaw-1.7.4/examples/avl/test_files/tree/custom_croissant_10.txt000066400000000000000000000000241216507631600253030ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10libclaw-1.7.4/examples/avl/test_files/tree/custom_croissant_20.txt000066400000000000000000000000621216507631600253060ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20libclaw-1.7.4/examples/avl/test_files/tree/custom_croissant_30.txt000066400000000000000000000001201216507631600253020ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30libclaw-1.7.4/examples/avl/test_files/tree/custom_decroissant_10.txt000066400000000000000000000000241216507631600256140ustar00rootroot0000000000000010 9 8 7 6 5 4 3 2 1libclaw-1.7.4/examples/avl/test_files/tree/ex_cours_11_1.txt000066400000000000000000000000351216507631600237560ustar00rootroot000000000000004 35 10 13 3 30 15 12 7 40 20libclaw-1.7.4/examples/avl/test_files/tree/ex_cours_8_1.txt000066400000000000000000000000171216507631600237040ustar00rootroot000000000000006 2 8 3 7 4 1 0libclaw-1.7.4/examples/avl/test_files/tree/ex_livre_10_1.txt000066400000000000000000000000321216507631600237400ustar00rootroot000000000000004 35 10 13 3 30 15 12 7 40libclaw-1.7.4/examples/compress/000077500000000000000000000000001216507631600166205ustar00rootroot00000000000000libclaw-1.7.4/examples/compress/CMakeLists.txt000066400000000000000000000005361216507631600213640ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-codec-example) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) find_package(libclaw) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) add_definitions( ${CLAW_DEFINITIONS} ) add_executable( ex-compress compress.cpp ) add_executable( ex-decompress decompress.cpp ) libclaw-1.7.4/examples/compress/compress.cpp000066400000000000000000000070471216507631600211670ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ #include #include #include #include #include #include #include #include /*----------------------------------------------------------------------------*/ /** * \brief The input_buffer is the stream where raw data is read by the LZW * encoder. */ class input_buffer { public: input_buffer( std::istream& is ) : stream(is) { stream.read_more(1024); } bool end_of_data() const { return !stream; } unsigned int symbols_count() const { return (unsigned int)std::numeric_limits::max() + 2; } unsigned int get_next() { assert(stream.remaining() > 0); unsigned int result = (unsigned char)stream.get_next(); if ( stream.remaining() == 0 ) stream.read_more(1024); return result; } private: claw::buffered_istream stream; }; /*----------------------------------------------------------------------------*/ /** * \brief The output_buffer is an interface between the LZW encoder and the * stream where the encoded data is written. */ class output_buffer { public: output_buffer( std::ostream& os, const unsigned int max ) : buffer(os), stream(buffer), m_max_code(max), m_code_size(9), m_code_limit(1 << m_code_size) { } unsigned int max_code() const { return m_max_code; } void reset() { m_code_size = 9; m_code_limit = 1 << m_code_size; } void new_code( unsigned int code ) { if (code == m_code_limit) { ++m_code_size; m_code_limit = 1 << m_code_size; } } void write( unsigned int code ) { stream.write( (char*)&code, m_code_size ); } private: claw::buffered_ostream buffer; claw::bit_ostream< claw::buffered_ostream > stream; const unsigned int m_max_code; unsigned int m_code_size; unsigned int m_code_limit; }; /*----------------------------------------------------------------------------*/ int main( int argc, char* argv[] ) { if ( argc != 1 ) { std::cerr << "This program encodes a stream using LZW algorithm. The data" << " to encode is read on standard input, and the result is" << " written in standard output." << std::endl; } else { claw::lzw_encoder encoder; input_buffer input(std::cin); output_buffer output(std::cout, 4096); while ( !input.end_of_data() ) { output.reset(); encoder.encode(input, output); output.write(256); } } return 0; } libclaw-1.7.4/examples/compress/decompress.cpp000066400000000000000000000037761216507631600215050ustar00rootroot00000000000000#include #include #include #include #include #include #include /*----------------------------------------------------------------------------*/ class input_buffer { public: input_buffer( std::istream& is ) : val(0), buffer(is), stream(buffer), m_code_size(9), m_code_limit(1 << m_code_size) { } bool end_of_data() const { return !stream || (val == 256); } unsigned int symbols_count() const { return (unsigned int)std::numeric_limits::max() + 2; } unsigned int get_next() { val = 0; stream.read( reinterpret_cast(&val), m_code_size ); return val; } void reset() { val = 0; m_code_size = 9; m_code_limit = 1 << m_code_size; } void new_code( unsigned int code ) { if ( (code == m_code_limit) && (m_code_size != 12) ) { ++m_code_size; m_code_limit = 1 << m_code_size; } } private: unsigned int val; claw::buffered_istream buffer; claw::bit_istream< claw::buffered_istream > stream; unsigned int m_code_size; unsigned int m_code_limit; }; /*----------------------------------------------------------------------------*/ class output_buffer { public: output_buffer( std::ostream& os, unsigned int max ) : stream(os), m_max_code(max) { } unsigned int max_code() const { return m_max_code; } void write( unsigned int code ) { assert(code < 256); const char v(code); stream.write(v); } private: claw::buffered_ostream stream; const unsigned int m_max_code; }; /*----------------------------------------------------------------------------*/ int main() { claw::lzw_decoder decoder; input_buffer input(std::cin); output_buffer output(std::cout, 4096); while ( std::cin ) { input.reset(); decoder.decode(input, output); } return 0; } libclaw-1.7.4/examples/config_file/000077500000000000000000000000001216507631600172315ustar00rootroot00000000000000libclaw-1.7.4/examples/config_file/CMakeLists.txt000066400000000000000000000016121216507631600217710ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-config_file-example) # check profiling mode if( CMAKE_BUILD_TYPE MATCHES profile ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -pg" ) endif( CMAKE_BUILD_TYPE MATCHES profile ) # check DEBUG mode if( CMAKE_BUILD_TYPE MATCHES debug ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DEBUG" ) endif( CMAKE_BUILD_TYPE MATCHES debug ) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) #------------------------------------------------------------------------------- # look for libraries find_package(libclaw) add_definitions( ${CLAW_DEFINITIONS} ) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) link_directories( ${CLAW_LINK_DIRECTORY} ) add_executable( ex-config main.cpp application.cpp ) target_link_libraries( ex-config ${CLAW_CONFIGURATION_FILE_LIBRARIES} ${CLAW_APPLICATION_LIBRARIES} ) libclaw-1.7.4/examples/config_file/application.cpp000066400000000000000000000053751216507631600222520ustar00rootroot00000000000000#include "application.hpp" #include /*----------------------------------------------------------------------------*/ ex_config::ex_config( int& argc, char** &argv ) : claw::application(argc, argv), m_quit(false), m_noname_section(true) { check_arguments( argc, argv ); } // ex_config::ex_config() /*----------------------------------------------------------------------------*/ int ex_config::run() { if (m_quit) return 0; std::ifstream f( m_filename.c_str() ); if (!f) std::cerr << "can't open file '" << m_filename << "'" << std::endl; else if ( !m_config.open(f) ) std::cerr << "syntax error in '" << m_filename << "'" << std::endl; else { std::cout << "field value is '"; if ( m_noname_section ) std::cout << m_config(m_field); else std::cout << m_config(m_section, m_field); std::cout << "'" << std::endl; std::cout << "all values are:\n"; claw::configuration_file::const_field_iterator it, last; if ( m_noname_section ) { it = m_config.field_begin(m_field); last = m_config.field_end(m_field); } else { it = m_config.field_begin(m_section, m_field); last = m_config.field_end(m_section, m_field); } for ( ; it!=last; ++it ) std::cout << "\t'" << *it << "'\n"; std::cout << "The sections of the file are:\n"; claw::configuration_file::const_file_iterator itf; for (itf=m_config.file_begin(); itf!=m_config.file_end(); ++itf) std::cout << '\'' << *itf << "'\n"; std::cout.flush(); } return 0; } // ex_config::run() /*----------------------------------------------------------------------------*/ /** * \brief Check program arguments. * \param argc Number of program arguments. * \param argv Program arguments. */ void ex_config::check_arguments( int& argc, char** &argv ) { m_arguments.add_long("--config", "Configuration file to open", false, "file"); m_arguments.add_long ("--field", "The name of the field to find.", false, "string"); m_arguments.add_long ("--section", "section in which the field is.", true, "string"); m_arguments.add("-h", "--help", "Print this message and exit.", true); m_arguments.parse( argc, argv ); if ( m_arguments.get_bool("-h") || !m_arguments.required_fields_are_set() ) { std::cout << m_arguments.required_fields_are_set() << std::endl; m_arguments.help(); m_quit = true; } else { m_noname_section = !m_arguments.has_value("--section"); if ( !m_noname_section ) m_section = m_arguments.get_string("--section"); m_field = m_arguments.get_string("--field"); m_filename = m_arguments.get_string("--config"); } } // ex_config::check_arguments() libclaw-1.7.4/examples/config_file/application.hpp000066400000000000000000000006541216507631600222520ustar00rootroot00000000000000#include #include class ex_config : public claw::application { public: ex_config( int& argc, char** &argv ); int run(); private: void check_arguments( int& argc, char** &argv ); private: bool m_quit; claw::configuration_file m_config; std::string m_filename; bool m_noname_section; std::string m_section; std::string m_field; }; // class ex_config libclaw-1.7.4/examples/config_file/config.sample000066400000000000000000000003301216507631600216750ustar00rootroot00000000000000# comment field = value [section] # in line comment #more comments field1 = value \# 2 \ remaining string field = foo field = bar [section \# 2] # working ? field \#4 = some value \\\\\\\\# is this a comment ? libclaw-1.7.4/examples/config_file/main.cpp000066400000000000000000000001021216507631600206520ustar00rootroot00000000000000#include "application.hpp" CLAW_APPLICATION_IMPLEMENT(ex_config) libclaw-1.7.4/examples/curve/000077500000000000000000000000001216507631600161115ustar00rootroot00000000000000libclaw-1.7.4/examples/curve/CMakeLists.txt000066400000000000000000000010331216507631600206460ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-curve-example) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) #------------------------------------------------------------------------------- # look for libraries find_package(libclaw) add_definitions( ${CLAW_DEFINITIONS} ) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) link_directories( ${CLAW_LINK_DIRECTORY} ) add_executable( ex-curve main.cpp ) target_link_libraries( ex-curve ${CLAW_CURVE_LIBRARIES} ${CLAW_GRAPHIC_LIBRARIES} ) libclaw-1.7.4/examples/curve/example000066400000000000000000000000631216507631600174660ustar00rootroot000000000000000 0 0 0 75 25 50 75 75 75 25 75 100 0 25 25 100 0 libclaw-1.7.4/examples/curve/main.cpp000066400000000000000000000110101216507631600175320ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ /** * \file * \brief Example program for the Bézier curves of Claw. * \author Julien Jorge */ #include #include #include #include #include typedef claw::math::coordinate_2d coordinate_type; typedef claw::math::curve curve_type; /** * \brief Read the points of a curve from a stream. * * The stream must describe the points in the following format: * x y in_x in_y out_x out_y * * Where (x, y) is the coordinate of the control point, (in_x, in_y) is the * coordinate of the direction of the curve when entering the point and * (out_x, out_y) is the direction of the curve when leaving the point. * * If the in and out points are not set, they are set to (x, y) by default. * * \param c The curve to which the points are added. * \param is The stream from which the curve is read. */ claw::math::coordinate_2d read_curve( curve_type& c, std::istream& is ) { claw::math::coordinate_2d max(0, 0); std::string line; while ( claw::text::getline( is, line ) ) { std::istringstream iss(line); coordinate_type position; if ( iss >> position.x >> position.y ) { max.x = std::max( (std::size_t)position.x, max.x ); max.y = std::max( (std::size_t)position.y, max.y ); coordinate_type in, out; if ( iss >> in.x >> in.y >> out.x >> out.y ) c.push_back( curve_type::control_point(position, in, out) ); else c.push_back( curve_type::control_point(position) ); } } return max; } // read_curve() /** * \brief Draw the curve with a given precision. * \param result The image in which the curve is drawn. * \param c The curve to draw. * \param step The step between two points of the curve. */ void draw_curve ( claw::graphic::image& result, const curve_type& c, double step ) { for ( curve_type::const_iterator it=c.begin(); it!=c.end(); ++it ) { const curve_type::section s( c.get_section(it) ); for ( double t(0); t<=1; t+=step ) { const claw::math::coordinate_2d p( s.get_point_at(t) ); if ( ( (0 <= p.x) && (p.x < (int)result.width()) ) && ( (0 <= p.y) && (p.y < (int)result.height()) ) ) result[ p.y ][ p.x ] = claw::graphic::black_pixel; } } } // draw_curve() /** * \brief Draw a curve in an image. */ int main( int argc, char* argv[] ) { if ( argc != 2 ) { std::cerr << "usage:\n" << '\t' << argv[0] << " step\n\n" << "The program reads the coordinates of the curve on stdin.\n" << "Each line represents a point in the following format:\n" << "\tx y input_x input_y output_x output_y\n" << "The curve is drawn in an image saved as output.png with a" << " detail of step.\n\n" << "example:\n" << "\tcat example | " << argv[0] << "0.001\n\n" << "where the content of example is:\n" << "0 0 0 0 75 25\n" << "50 75 75 75 25 75\n" << "100 0 25 25 100 0"; std::cerr << std::endl; return 1; } double step(1); std::istringstream iss(argv[1]); iss >> step; curve_type c; claw::math::coordinate_2d bounds = read_curve( c, std::cin ); claw::graphic::png result( bounds.x, bounds.y ); std::fill( result.begin(), result.end(), claw::graphic::white_pixel ); draw_curve( result, c, step ); std::ofstream f("output.png"); result.save( f ); return 0; } // main() libclaw-1.7.4/examples/dynamic_library/000077500000000000000000000000001216507631600201355ustar00rootroot00000000000000libclaw-1.7.4/examples/dynamic_library/CMakeLists.txt000066400000000000000000000016161216507631600227010ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-dynamic_library-example) # check profiling mode if( CMAKE_BUILD_TYPE MATCHES profile ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -pg" ) endif( CMAKE_BUILD_TYPE MATCHES profile ) # check DEBUG mode if( CMAKE_BUILD_TYPE MATCHES debug ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DEBUG" ) endif( CMAKE_BUILD_TYPE MATCHES debug ) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) #------------------------------------------------------------------------------- # look for libraries find_package(libclaw) add_definitions( ${CLAW_DEFINITIONS} ) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) link_directories( ${CLAW_LINK_DIRECTORY} ) add_library( func SHARED func.cpp ) add_executable( ex-dynamic_library main.cpp ) target_link_libraries( ex-dynamic_library ${CLAW_DYNAMIC_LIBRARY_LIBRARIES} ) libclaw-1.7.4/examples/dynamic_library/README000066400000000000000000000004311216507631600210130ustar00rootroot00000000000000program_name: ex-dynamic_library This example program shows basic use of the claw::dynamic_library class. The program takes some strings as arguments. The symbol corresponding to the first one is searched in the current program, the others are searched in the libfunc.so libary. libclaw-1.7.4/examples/dynamic_library/func.cpp000066400000000000000000000005021216507631600215710ustar00rootroot00000000000000/* Example library for the claw::dynamic_library class. */ #include #include extern "C" { void first_function( const std::string& s ) { std::cout << "first : " << s << std::endl; } void second_function( const std::string& s ) { std::cout << "second : " << s << std::endl; } } libclaw-1.7.4/examples/dynamic_library/main.cpp000066400000000000000000000033651216507631600215740ustar00rootroot00000000000000/* Example program for the claw::dynamic_library class. */ #include #include #ifdef _WIN32 # define DLLEXPORT __declspec(dllexport) #else # define DLLEXPORT #endif typedef void (*function_type)( const std::string& s ); extern "C" DLLEXPORT void in_program( const std::string& s ) { std::cout << "in_program : " << s << std::endl; } int main( int argc, char** argv ) { if ( argc < 2 ) { std::cout << argv[0] << " method_name...\n"; std::cout << "\tThe first method_name is searched in the current " << "program\n"; std::cout << "\tThe next arguments are searched in the ./libfunc.so " << "shared library." << std::endl; } else { /* Load the library. */ #ifdef _WIN32 claw::dynamic_library dl( "./libfunc.dll" ); #else claw::dynamic_library dl( "./libfunc.so" ); #endif /* Load the current program. */ claw::dynamic_library current_prog( argv[0], true ); function_type f; /* Search in the current program. */ if ( current_prog.have_symbol( argv[1] ) ) { f = current_prog.get_symbol( argv[1] ); f( "The string passed to a method in the current program" ); } else std::cout << "Symbol '" << argv[1] << "' not found in the current program." << std::endl; /* We try to find the next symbols passed as arguments */ for (int i=2; i( argv[i] ); f( "The string passed to the method" ); } else std::cout << "Symbol '" << argv[i] << "' not found." << std::endl; } return 0; } libclaw-1.7.4/examples/dynamic_library/test_files/000077500000000000000000000000001216507631600222765ustar00rootroot00000000000000libclaw-1.7.4/examples/dynamic_library/test_files/expected/000077500000000000000000000000001216507631600240775ustar00rootroot00000000000000libclaw-1.7.4/examples/dynamic_library/test_files/expected/test.out000066400000000000000000000004631216507631600256120ustar00rootroot00000000000000in_program : The string passed to a method in the current program Symbol 'nowhere' not found. first : The string passed to the method second : The string passed to the method Symbol 'nowhere' not found in the current program. first : The string passed to the method second : The string passed to the method libclaw-1.7.4/examples/dynamic_library/test_files/scripts/000077500000000000000000000000001216507631600237655ustar00rootroot00000000000000libclaw-1.7.4/examples/dynamic_library/test_files/scripts/test.sh000066400000000000000000000002161216507631600252770ustar00rootroot00000000000000#!/bin/sh ./ex-dynamic_library in_program nowhere first_function second_function ./ex-dynamic_library nowhere first_function second_function libclaw-1.7.4/examples/game_ai/000077500000000000000000000000001216507631600163475ustar00rootroot00000000000000libclaw-1.7.4/examples/game_ai/CMakeLists.txt000066400000000000000000000001401216507631600211020ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-ia-example) subdirs(matches morpion_console) libclaw-1.7.4/examples/game_ai/matches/000077500000000000000000000000001216507631600177735ustar00rootroot00000000000000libclaw-1.7.4/examples/game_ai/matches/CMakeLists.txt000066400000000000000000000012271216507631600225350ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-matches-example) # check profiling mode if( CMAKE_BUILD_TYPE MATCHES profile ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -pg" ) endif( CMAKE_BUILD_TYPE MATCHES profile ) # check DEBUG mode if( CMAKE_BUILD_TYPE MATCHES debug ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DEBUG" ) endif( CMAKE_BUILD_TYPE MATCHES debug ) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) find_package(libclaw) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) add_definitions( ${CLAW_DEFINITIONS} ) add_executable( ex-matches main.cpp matches.cpp matches_main.cpp ) libclaw-1.7.4/examples/game_ai/matches/README000066400000000000000000000000541216507631600206520ustar00rootroot00000000000000An sample game using the Min-Max algorithm. libclaw-1.7.4/examples/game_ai/matches/main.cpp000066400000000000000000000001151216507631600214200ustar00rootroot00000000000000#include "matches_main.hpp" int main() { matches_main game; return 0; } libclaw-1.7.4/examples/game_ai/matches/matches.cpp000066400000000000000000000057651216507631600221400ustar00rootroot00000000000000/** * \file matches.cpp * \brief Implementation of the state_matches class. * \author Julien Jorge */ #include "matches.hpp" #include template<> const int claw::ai::game::game_state::s_min_score = -100; template<> const int claw::ai::game::game_state::s_max_score = 100; /*---------------------------------------------------------------------------*/ /** * \brief Output a state as text. * \param os The stream in which we write. * \param e The state to print. * \return os. */ std::ostream& operator<<(std::ostream& os, const state_matches& e) { int i; for (i=0; i!=e.m_matches; ++i) { os << "|"; if ( i%3 == 2 ) os << " "; } os << std::endl; return os; } // operator<<() /*---------------------------------------------------------------------------*/ /** * \brief Constructor. * \param matches Initial count of matches. * \param computer Tell if the computer starts to play. */ state_matches::state_matches( int matches, bool computer ) : m_computer(computer), m_matches(matches) { } // state_matches::state_matches() /*---------------------------------------------------------------------------*/ /** * \brief Remove some matches and change the player. * \param c The count of matches to remove. * \return true if the action ends the game. */ bool state_matches::play( int c ) { m_matches -= std::min(m_matches, c); m_computer = !m_computer; return m_matches == 0; } // state_matches::play() /*---------------------------------------------------------------------------*/ /** * \brief Get a new state obtained when applying an action. * \param a The action to apply. * \return The state resulting from this action. */ state_matches::state* state_matches::do_action( const int& a ) const { state_matches* em = new state_matches(*this); em->play(a); return em; } // state_matches::do_action() /*---------------------------------------------------------------------------*/ /** * \brief Tell if the game is over. */ bool state_matches::final() const { return m_matches == 0; } // state_matches::final() /*---------------------------------------------------------------------------*/ /** * \brief Get all actions that can be done from this state. * \param l (out) The actions. */ void state_matches::next_actions( std::list& l ) const { for (int i=0; i!=3; ++i) if (m_matches > i) l.push_back(i+1); } // state_matches::next_actions() /*---------------------------------------------------------------------------*/ /** * \brief Evaluate this state of the game. */ int state_matches::evaluate() const { int score = 0; // no more matches. if (m_matches == 0) { // Its the computer's turn, so the player took the last match. Good. if( m_computer ) score = 100; else // otherwise, the computer losts. score = -100; } return score; } // state_matches::evaluate() libclaw-1.7.4/examples/game_ai/matches/matches.hpp000066400000000000000000000017371216507631600221400ustar00rootroot00000000000000/** * \file allumettes.hpp * \brief The class representing the state of the game. * \author Julien Jorge */ #ifndef __MATCHES_HPP__ #define __MATCHES_HPP__ #include "claw/game_ai.hpp" #include /** * \brief The class representing the state of the game. * \author Julien Jorge */ class state_matches: public claw::ai::game::game_state { private: typedef claw::ai::game::game_state state; public: friend std::ostream& operator<< (std::ostream& os, const state_matches& e); state_matches( int matches, bool computer ); bool play( int c ); //- // methods from game_state //- state* do_action( const int& a ) const; bool final() const; void next_actions( std::list& l ) const; int evaluate() const; //- // End of the methods from game_state //- private: /** \brief Tell if it is the computer's turn. */ bool m_computer; /** \brief Remaining matches. */ int m_matches; }; // state_matches #endif // MATCHES_HPP libclaw-1.7.4/examples/game_ai/matches/matches_main.cpp000066400000000000000000000073251216507631600231360ustar00rootroot00000000000000/** * \file matches_main.cpp * \brief Implementation of the matches_main class. * \author Julien Jorge */ #include "matches.hpp" #include "matches_main.hpp" #include /*---------------------------------------------------------------------------*/ /** * \brief Constructor. Start the game. */ matches_main::matches_main() { int matches = 0; int difficulty = 0; char first = 'o'; std::cout << "How many matches? [3 or more] : "; std::cin >> matches; std::cout << "Difficulty [1 or more] : "; std::cin >> difficulty; std::cout << "Do you start (y/n) : "; std::cin >> first; if ( (first=='y') || (first=='Y') ) play_human_first(matches, difficulty); else play_computer_first(matches, difficulty); } // matches_main() /*---------------------------------------------------------------------------*/ /** * \brief Make the computer to play. * \param state The current state of the game. * \param difficulty Difficulty level. * \return true if the game is over. */ bool matches_main::play_computer(state_matches& state, int difficulty) { claw::ai::game::select_action< claw::ai::game::min_max > select; int action = 1; select(difficulty, state, action, true); return state.play(action); } // play_computer() /*---------------------------------------------------------------------------*/ /** * \brief Ask the human player to play. * \param state The current state of the game. * \return true if the game is over. */ bool matches_main::play_human(state_matches& state) { unsigned int c; std::cout << "How many matches do you take? [1..3] : "; std::cin >> c; if ( (c > 3) || (c==0) ) return true; else return state.play(c); } // play_human() /*---------------------------------------------------------------------------*/ /** * \brief Start a game beginning by the human player. * \param matches Original count of matches. * \param difficulty Difficulty level. */ void matches_main::play_human_first( int matches, int difficulty ) { state_matches state(matches, false); std::cout << state << std::endl; bool stop = play_human(state); if (stop) std::cout << "you lost" << std::endl; else { while ( !stop ) { std::cout << state << std::endl; stop = play_computer( state, difficulty ); if ( !stop ) { std::cout << state << std::endl; stop = play_human(state); if (stop) std::cout << "you lost" << std::endl; } else std::cout << "you win" << std::endl; } std::cout << state << std::endl; } } /*---------------------------------------------------------------------------*/ /** * \brief Start a game beginning by the human player. * \param matches Original count of matches. * \param difficulty Difficulty level. */ void matches_main::play_computer_first( int matches, int difficulty ) { state_matches state(matches, true); std::cout << state << std::endl; bool stop = play_computer( state, difficulty ); if (stop) std::cout << "you win" << std::endl; else { while ( !stop ) { std::cout << state << std::endl; stop = play_human(state);; if ( !stop ) { std::cout << state << std::endl; stop = play_computer(state, difficulty); if (stop) std::cout << "you win" << std::endl; } else std::cout << "you lost" << std::endl; } std::cout << state << std::endl; } } libclaw-1.7.4/examples/game_ai/matches/matches_main.hpp000066400000000000000000000010741216507631600231360ustar00rootroot00000000000000/** * \file matches_main.hpp * \brief Main class of the game. * \author Julien Jorge */ #ifndef __MATCHES_MAIN_HPP__ #define __MATCHES_MAIN_HPP__ #include "matches.hpp" /** * \brief Main class of the game. * \author Julien Jorge */ class matches_main { public: matches_main(); private: bool play_computer(state_matches& state, int difficulty); bool play_human(state_matches& state); void play_human_first( int matches, int difficulty ); void play_computer_first( int matches, int difficulty ); }; //class matches_main #endif // __MATCHES_MAIN_HPP__ libclaw-1.7.4/examples/game_ai/morpion_console/000077500000000000000000000000001216507631600215545ustar00rootroot00000000000000libclaw-1.7.4/examples/game_ai/morpion_console/CMakeLists.txt000066400000000000000000000012271216507631600243160ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-morpion-example) # check profiling mode if( CMAKE_BUILD_TYPE MATCHES profile ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -pg" ) endif( CMAKE_BUILD_TYPE MATCHES profile ) # check DEBUG mode if( CMAKE_BUILD_TYPE MATCHES debug ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DEBUG" ) endif( CMAKE_BUILD_TYPE MATCHES debug ) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) find_package(libclaw) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) add_definitions( ${CLAW_DEFINITIONS} ) add_executable( ex-morpion main.cpp morpion.cpp morpion_main.cpp ) libclaw-1.7.4/examples/game_ai/morpion_console/README000066400000000000000000000001001216507631600224230ustar00rootroot00000000000000Un petit exemple de programme utilisant l'algorithme Alpha-Beta.libclaw-1.7.4/examples/game_ai/morpion_console/main.cpp000066400000000000000000000001151216507631600232010ustar00rootroot00000000000000#include "morpion_main.hpp" int main() { morpion_main jeu; return 0; } libclaw-1.7.4/examples/game_ai/morpion_console/morpion.cpp000066400000000000000000000212561216507631600237510ustar00rootroot00000000000000/** * \file morpion.cpp * \brief Implémentation des classes symbole_morpion et etat_morpion. * \author Julien Jorge */ #include "morpion.hpp" #include template<> const int claw::ai::game::game_state::s_min_score = -100; template<> const int claw::ai::game::game_state::s_max_score = 100; //*********************** symbole_morpion ************************************ /*--------------------------------------------------------------------------*/ /** * \brief Constructeur. */ symbole_morpion::symbole_morpion() : s(EM_RIEN) { } // symbole_morpion() [constructeur] /*--------------------------------------------------------------------------*/ /** * \brief Constructeur avec un symbole. */ symbole_morpion::symbole_morpion(symbole symb) : s(symb) { } // symbole_morpion(s) [constructeur] /*--------------------------------------------------------------------------*/ /** * \brief Opérateur d'égalité. */ bool symbole_morpion::operator==(const symbole_morpion& symb) const { return s == symb.s; } // operator==() /*--------------------------------------------------------------------------*/ /** * \brief Opérateur de différence. */ bool symbole_morpion::operator!=(const symbole_morpion& symb) const { return !(s == symb.s); } // operator!=() /*--------------------------------------------------------------------------*/ /** * \brief Symbole opposé. */ symbole symbole_morpion::operator!() const { switch (s) { case EM_CROIX : return EM_ROND; case EM_ROND : return EM_CROIX; default : return EM_RIEN; } } // operator!() /*--------------------------------------------------------------------------*/ /** * \brief Forme textuelle. * \param os Flux sur lequel écrire. * \param symb symbole ŕ écrire. */ std::ostream& operator<<(std::ostream& os, const symbole_morpion& symb) { switch (symb.s) { case EM_CROIX : os << "X"; break; case EM_ROND : os << "O"; break; case EM_RIEN : os << "."; break; } return os; } // operator<<() //************************** etat_morpion ************************************ symbole_morpion etat_morpion::s_symbole_ordi; /*--------------------------------------------------------------------------*/ /** * \brief Affiche un état sur un flux. * \param os Flux sur lequel écrire. * \param e Damier ŕ afficher. */ std::ostream& operator<<(std::ostream& os, const etat_morpion& e) { int i; os << "symbole : " << e.m_symbole << std::endl; for (i=0; i!=3; ++i) os << e.cases()[i]; os << std::endl; for (i=3; i!=6; ++i) os << e.cases()[i]; os << std::endl; for (i=6; i!=9; ++i) os << e.cases()[i]; os << std::endl; return os; } // operator<<() /*--------------------------------------------------------------------------*/ /** * \brief Constructeur. * \param symb symbole du prochain joueur. */ etat_morpion::etat_morpion( symbole symb /*= EM_RIEN*/ ) : m_symbole(symb), m_cases(9, EM_RIEN) { } // etat_morpion() [constructeur] /*--------------------------------------------------------------------------*/ /** * \brief Joue le symbole en cours dans une case et passe au symbole suivant. * \param c Indice de la case. */ bool etat_morpion::jouer( int c ) { bool ret = false; m_cases[c] = m_symbole; ret = gagne( m_symbole ); m_symbole = !m_symbole; return ret; } // jouer() /*--------------------------------------------------------------------------*/ /** * \brief Indique si le jeu est plein. */ bool etat_morpion::plein() const { bool ret = true; std::vector::const_iterator it; for (it = m_cases.begin(); (it!=m_cases.end() && ret); ++it) ret = *it != EM_RIEN; return ret; } // plein() /*--------------------------------------------------------------------------*/ /** * \brief Affecte la valeur du symbole de l'ordi. * \param symb Le nouveau symbole de l'ordi. */ void etat_morpion::symbole_ordi( const symbole_morpion& symb ) { s_symbole_ordi = symb; } // symbole_ordi() /*--------------------------------------------------------------------------*/ /** * \brief Indique si l'état actuel est gagnant pour un symbole. * \param symb Symbole qui pourrait avoir gagné. */ bool etat_morpion::gagne( const symbole_morpion& symb ) const { // lignes passant par le centre if ( m_cases[4] == symb ) { if ( (m_cases[0] == symb ) && (m_cases[8] == symb ) ) return true; else if ( ( m_cases[1] == symb ) && (m_cases[7] == symb) ) return true; else if ( ( m_cases[2] == symb ) && (m_cases[6] == symb) ) return true; else if ( ( m_cases[3] == symb ) && (m_cases[5] == symb) ) return true; } // lignes partant du coin haut gauche, sauf diagonale if ( m_cases[0] == symb ) { if ( (m_cases[1] == symb ) && (m_cases[2] == symb ) ) return true; else if ( ( m_cases[3] == symb ) && (m_cases[6] == symb) ) return true; } // lignes partant du coin bas droit, sauf diagonale if ( m_cases[8] == symb ) { if ( (m_cases[6] == symb ) && (m_cases[7] == symb ) ) return true; else if ( ( m_cases[2] == symb ) && (m_cases[5] == symb) ) return true; } return false; } // gagne() /*--------------------------------------------------------------------------*/ /** * \brief Récupčre les valeurs des cases. */ const std::vector& etat_morpion::cases() const { return m_cases; } // cases() /*--------------------------------------------------------------------------*/ /** * \brief Effectuer une action. * \param a L'action a effectuer. * \return L'état résultant de cette action. */ etat_morpion::state* etat_morpion::do_action( const int& a ) const { etat_morpion* em = new etat_morpion(*this); em->m_cases[a] = em->m_symbole; // on marque la case em->m_symbole = !em->m_symbole; // on passe la main return em; } // do_action() /*--------------------------------------------------------------------------*/ /** * \brief Indique si la partie est terminée. */ bool etat_morpion::final() const { if ( gagne( m_symbole ) ) return true; else if ( gagne( !m_symbole ) ) return true; else return plein(); } // final() /*--------------------------------------------------------------------------*/ /** * \brief Calcule la liste des actions jouables depuis l'état actuel. * \param l (sortie) Liste des coups jouables. */ void etat_morpion::next_actions( std::list& l ) const { for (int i=0; i!=9; ++i) if ( m_cases[i] == EM_RIEN ) l.push_back(i); } // next_actions() /*--------------------------------------------------------------------------*/ /** * Evalue l'état actuel, du point de vue de l'ordinateur. */ int etat_morpion::evaluate() const { int score; if ( gagne( s_symbole_ordi ) ) { if ( gagne( !s_symbole_ordi ) ) score = 0; else score = 100; } else if ( gagne( !s_symbole_ordi ) ) score = -100; else { int score_ligne; score = 0; score_ligne = poids_des_symboles(0, 1, 2); score += score_ligne * 4; score_ligne = poids_des_symboles(3, 4, 5); score += score_ligne * 4; score_ligne = poids_des_symboles(6, 7, 8); score += score_ligne * 4; score_ligne = poids_des_symboles(0, 3, 6); score += score_ligne * 4; score_ligne = poids_des_symboles(1, 4, 7); score += score_ligne * 4; score_ligne = poids_des_symboles(2, 5, 8); score += score_ligne * 4; score_ligne = poids_des_symboles(0, 4, 8); score += score_ligne * 4; score_ligne = poids_des_symboles(2, 4, 6); score += score_ligne * 4; } return score; } // evaluate() /*--------------------------------------------------------------------------*/ /** * Calcule la supériorité du symbole de l'ordinateur sur son contraire sur trois cases. * \param a indice de la premičre case. * \param b indice de la deuxičme case. * \param c indice de la troisičme case. */ int etat_morpion::poids_des_symboles(int a, int b, int c) const { int s = 0; symbole_morpion contraire = !s_symbole_ordi; if ( m_cases[a] == s_symbole_ordi) ++s; else if ( m_cases[a] == contraire ) --s; if ( m_cases[b] == s_symbole_ordi) ++s; else if ( m_cases[b] == contraire ) --s; if ( m_cases[c] == s_symbole_ordi) ++s; else if ( m_cases[c] == contraire ) --s; return s; } // poids_des_symboles() libclaw-1.7.4/examples/game_ai/morpion_console/morpion.hpp000066400000000000000000000042601216507631600237520ustar00rootroot00000000000000/** * \file morpion.hpp * \brief Description du damier du morpion. * \author Julien Jorge */ #ifndef __MORPION_HPP__ #define __MORPION_HPP__ #include "claw/game_ai.hpp" #include //*********************** symbole_morpion ************************************ /** \brief Les symboles que l'on peut trouver dans les cases. */ enum symbole { EM_RIEN, EM_CROIX, EM_ROND }; /** \brief Une classe pour nous simplifier la manipulation des symboles. */ struct symbole_morpion { symbole s; symbole_morpion(); symbole_morpion(symbole symb); bool operator==(const symbole_morpion& symb) const; bool operator!=(const symbole_morpion& symb) const; symbole operator!() const; inline friend std::ostream& operator<<(std::ostream& os, const symbole_morpion& symb); }; // symbole_morpion //************************** etat_morpion ************************************ /** * \brief Description du damier du morpion. * \author Julien Jorge */ class etat_morpion : public claw::ai::game::game_state { private: typedef claw::ai::game::game_state state; public: friend std::ostream& operator<<(std::ostream& os, const etat_morpion& e); etat_morpion( symbole symbole = EM_RIEN ); bool jouer( int c ); bool plein() const; static void symbole_ordi( const symbole_morpion& symbole ); bool gagne( const symbole_morpion& symbole ) const; const std::vector& cases() const; //- // Partie nécessaire ŕ l'intelligence artificielle //- virtual state* do_action( const int& a ) const; virtual bool final() const; virtual void next_actions( std::list& l ) const; int evaluate() const; //- // Fin partie nécessaire ŕ l'intelligence artificielle //- private: int poids_des_symboles(int a, int b, int c) const; private: /** \brief Symbole qui va jouer. */ symbole_morpion m_symbole; /** \brief Etat des cases. */ std::vector m_cases; /** \brief Symbole de l'ordinateur. */ static symbole_morpion s_symbole_ordi; }; // etat_morpion #endif // __MORPION_HPP__ libclaw-1.7.4/examples/game_ai/morpion_console/morpion_main.cpp000066400000000000000000000063641216507631600247600ustar00rootroot00000000000000/** * \file morpion_main.cpp * \brief Implémentation de la classe morpion_main. * \author Julien Jorge */ #include "morpion_main.hpp" #include "morpion.hpp" #include /*---------------------------------------------------------------------------*/ /** * \brief Constructeur. Lance le jeu. */ morpion_main::morpion_main() { int difficulte = 0; char commencer = 'o'; std::cout << "Difficulté [1..9] : "; std::cin >> difficulte; std::cout << "Vous commencez ? (o/n) : "; std::cin >> commencer; if ( (commencer=='o') || (commencer=='O') ) jouer_humain_premier(difficulte); else jouer_ordi_premier(difficulte); } // morpion_main() [constructeur] /*================================== private ================================*/ /*---------------------------------------------------------------------------*/ /** * \brief Joue un coup, de l'ordinateur. * \param etat Etat du jeu. * \param difficulte Niveau de difficulté. * \return vrai si la partie est terminée. */ bool morpion_main::jouer_ordi(etat_morpion& etat, int difficulte) { claw::ai::game::select_random_action< claw::ai::game::alpha_beta > select; int action = 0; select(difficulte, etat, action, true); if (etat.jouer(action)) return true; else if (etat.plein()) return true; else return false; } // jouer_ordi() /*---------------------------------------------------------------------------*/ /** * \brief Joue un coup, de l'humain. * \param etat Etat du jeu. * \return vrai si la partie est terminée. */ bool morpion_main::jouer_humain(etat_morpion& etat) { unsigned int c; std::cin >> c; if (c >= 9) return true; else if (etat.jouer(c)) return true; else if (etat.plein()) return true; else return false; } // jouer_humain() /*---------------------------------------------------------------------------*/ /** * \brief Lance le jeu, l'humain joue en premier. * \param difficulte Niveau de difficulté. */ void morpion_main::jouer_humain_premier( int difficulte ) { etat_morpion etat(EM_CROIX); etat.symbole_ordi(EM_ROND); std::cout << etat << std::endl; bool fini = jouer_humain(etat); while ( !fini ) { std::cout << etat << std::endl; fini = jouer_ordi( etat, difficulte ); if ( !fini ) { std::cout << etat << std::endl; fini = jouer_humain(etat); } } std::cout << etat << std::endl; } // jouer_humain_premier() /*---------------------------------------------------------------------------*/ /** * \brief Lance le jeu, l'ordinateur joue en premier. * \param difficulte Niveau de difficulté. */ void morpion_main::jouer_ordi_premier( int difficulte ) { etat_morpion etat(EM_ROND); etat.symbole_ordi(EM_ROND); std::cout << etat << std::endl; bool fini = jouer_ordi( etat, difficulte ); while ( !fini ) { std::cout << etat << std::endl; fini = jouer_humain(etat);; if ( !fini ) { std::cout << etat << std::endl; fini = jouer_ordi(etat, difficulte); } } std::cout << etat << std::endl; } // jouer_ordi_premier() libclaw-1.7.4/examples/game_ai/morpion_console/morpion_main.hpp000066400000000000000000000011621216507631600247540ustar00rootroot00000000000000/** * \file morpion_main.hpp * \brief Classe principale du jeu de morpion. Gčre le déroulement du jeu. * \author Julien Jorge */ #ifndef __MORPION_MAIN_HPP__ #define __MORPION_MAIN_HPP__ #include "morpion.hpp" /** * \brief Classe principale du jeu de morpion. Gčre le déroulement du jeu. * \author Julien Jorge */ class morpion_main { public: morpion_main(); private: bool jouer_ordi(etat_morpion& etat, int difficulte); bool jouer_humain(etat_morpion& etat); void jouer_humain_premier( int difficulte ); void jouer_ordi_premier( int difficulte ); }; //class morpion_main #endif // __MORPION_MAIN_HPP__ libclaw-1.7.4/examples/graph/000077500000000000000000000000001216507631600160665ustar00rootroot00000000000000libclaw-1.7.4/examples/graph/CMakeLists.txt000066400000000000000000000013001216507631600206200ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-graph-example) # check profiling mode if( CMAKE_BUILD_TYPE MATCHES profile ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -pg" ) endif( CMAKE_BUILD_TYPE MATCHES profile ) # check DEBUG mode if( CMAKE_BUILD_TYPE MATCHES debug ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DEBUG" ) endif( CMAKE_BUILD_TYPE MATCHES debug ) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) find_package(libclaw) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) add_definitions( ${CLAW_DEFINITIONS} ) add_executable( ex-graph main.cpp ) add_executable( ex-algo algos.cpp ) add_executable( mk_test mk_test.cpp ) libclaw-1.7.4/examples/graph/algos.cpp000066400000000000000000000150061216507631600177010ustar00rootroot00000000000000#include "claw/graph.hpp" #include "claw/graph_algorithm.hpp" #include #include /*---------------------------------------------------------------------------*/ /** * \brief A vertex of the graph. * \author Julien Jorge */ class vertex { public: int val; bool operator<(const vertex& s) const { return val < s.val; } bool operator==(const vertex& s) const { return val == s.val; } friend std::ostream& operator<<(std::ostream& os, const vertex& s) { return os << s.val; } }; // class vertex /*---------------------------------------------------------------------------*/ /** * \brief An edge of the graph * \author Julien Jorge */ class edge { public: char symbol; int weight; bool operator<(const edge& a) const { return weight < a.weight; } bool operator==(const edge& a) const { return (symbol == a.symbol) && (weight == a.weight); } friend std::ostream& operator<<(std::ostream& os, const edge& a) { return os << "[" << a.symbol << ", " << a.weight << "]"; } }; // class edge /*---------------------------------------------------------------------------*/ class pl_scan_events: public claw::scan_events< claw::graph > { public: pl_scan_events( const vertex& s ) { distances[s] = 0; } void visit_edge( const vertex& source, const vertex& dest ) { parents[dest] = source; distances[dest] = distances[source] + 1; } std::map distances; std::map parents; }; // class pl_scan_events /*---------------------------------------------------------------------------*/ class pp_scan_events: public claw::scan_events< claw::graph > { public: pp_scan_events() { m_date = 0; } void start(const vertex& s) { ++m_date; dates[s].first = m_date; } void visit_edge( const vertex& source, const vertex& dest ) { parents[dest] = source; } void end(const vertex& s) { ++m_date; dates[s].second = m_date; } std::map > dates; std::map parents; private: unsigned int m_date; }; // class pp_scan_events /*---------------------------------------------------------------------------*/ /** * \brief Output a text representation of a graph. */ template std::ostream& operator<<( std::ostream& os, const claw::graph& g) { typename claw::graph::vertex_iterator it_s; typename claw::graph::edge_iterator it_e; // vertices os << "S = {"; for (it_s = g.vertex_begin(); it_s != g.vertex_end(); ++it_s) { os << " " << *it_s; } os << " }" << std::endl; // edges os << "A = {" << std::endl; for (it_e = g.edge_begin(); it_e != g.edge_end(); ++it_e) os << " [" << it_e->label() << ", " << it_e->source() << ", " << it_e->target() << "]" << std::endl; os << " }" << std::endl; return os; } // operator<< /*---------------------------------------------------------------------------*/ void test_pl(const claw::graph& g) { vertex s; std::cout << "Distances, computed from vertex : " << std::endl; std::cin >> s.val; pl_scan_events events(s); claw::breadth_scan, pl_scan_events> scan ( g, s, events ); scan(); std::map::const_iterator it_d; for (it_d = events.distances.begin(); it_d!=events.distances.end(); ++it_d) std::cout << it_d->first.val << " to " << it_d->second << std::endl; std::map::const_iterator it_s; for (it_s = events.parents.begin(); it_s!=events.parents.end(); ++it_s) std::cout << it_s->second.val << " parent of " << it_s->first.val << std::endl; } /*---------------------------------------------------------------------------*/ void test_pp(const claw::graph& g) { pp_scan_events events; claw::depth_scan, pp_scan_events> scan( g, events ); scan(); std::map >::const_iterator it_d; for (it_d = events.dates.begin(); it_d!=events.dates.end(); ++it_d) std::cout << it_d->first.val << " : " << it_d->second.first << "," << it_d->second.second << std::endl; std::map::const_iterator it_s; for (it_s = events.parents.begin(); it_s!=events.parents.end(); ++it_s) std::cout << it_s->second.val << " parent of " << it_s->first.val << std::endl; } /*---------------------------------------------------------------------------*/ void test_topological_sort(const claw::graph& g) { claw::topological_sort< claw::graph > sort; claw::topological_sort< claw::graph >::const_iterator it; sort(g); for (it = sort.begin(); it!=sort.end(); ++it) std::cout << *it << std::endl; } // test_topological_sort() /*---------------------------------------------------------------------------*/ bool test_graphs( const std::string& filename ) { claw::graph g; vertex s1, s2; edge a; std::ifstream f(filename.c_str()); if (f) { while (f >> s1.val) { f >> s2.val; if (s2.val > 0) { f >> a.symbol >> a.weight; g.add_edge(s1, s2, a); } else { std::cout << s1 << " : isolé" << std::endl; g.add_vertex(s1); } } f.close(); std::cout << " -------------------------------------- display" << std::endl; std::cout << g << std::endl; std::cout << " ------------------- breadth scan" << std::endl; test_pl( g ); std::cout << " ------------------- deep scan" << std::endl; test_pp( g ); std::cout << " ------------------- topological order" << std::endl; test_topological_sort( g ); return true; } else return false; } // test_graphs() /*---------------------------------------------------------------------------*/ int main(int argc, char* argv[]) { if (argc != 2) { std::cout << argv[0] << " test_file" << std::endl; return 1; } else { try { if ( !test_graphs(argv[1]) ) std::cerr << "Can't process file '" << argv[1] << '\'' << std::endl; } catch( claw::graph_exception& e ) { std::cerr << e.what() << std::endl; } return 0; } } libclaw-1.7.4/examples/graph/main.cpp000066400000000000000000000256421216507631600175270ustar00rootroot00000000000000/** * \file main.cpp * \brief This program shows basic use of the claw::graph class. * \author Julien Jorge */ #include #include #include #include #include /*---------------------------------------------------------------------------*/ /** * \brief This class is a vertex in the graph. * \author Julien Jorge */ class vertex { public: int val; bool operator<(const vertex& s) const { return val < s.val; } bool operator==(const vertex& s) const { return val == s.val; } friend std::ostream& operator<<(std::ostream& os, const vertex& s) { return os << s.val; } }; // class vertex /*---------------------------------------------------------------------------*/ /** * \brief An edge in the graph. * \author Julien Jorge */ class edge { public: char symbol; int weight; bool operator<(const edge& a) const { return weight < a.weight; } bool operator==(const edge& a) const { return (symbol == a.symbol) && (weight == a.weight); } friend std::ostream& operator<<(std::ostream& os, const edge& a) { return os << "[" << a.symbol << ", " << a.weight << "]"; } }; // class edge /*---------------------------------------------------------------------------*/ /** * \brief Write a graph in a stream. */ template std::ostream& operator<<( std::ostream& os, const claw::graph& g) { typename claw::graph::vertex_iterator it_s; typename claw::graph::edge_iterator it_e; // vertices os << "V = {"; for (it_s = g.vertex_begin(); it_s != g.vertex_end(); ++it_s) { os << " " << *it_s; } os << " }" << std::endl; // edges os << "E = {" << std::endl; for (it_e = g.edge_begin(); it_e != g.edge_end(); ++it_e) os << " [" << it_e->label() << ", " << it_e->source() << ", " << it_e->target() << "]" << std::endl; os << " }" << std::endl; return os; } // operator<< /*---------------------------------------------------------------------------*/ /** * \brief Write some informations about a graph. */ void graph_infos( const claw::graph& g ) { std::vector v; g.vertices(v); std::cout << g.vertices_count() << " vertices" << std::endl; std::cout << g.edges_count() << " edges" << std::endl; for(unsigned int i=0; i!=v.size(); ++i) std::cout << "vertex: " << v[i].val << " outer degree: " << g.outer_degree(v[i]) << " inner degree: " << g.inner_degree(v[i]) << std::endl; std::cout << "adjacency list" << std::endl; for(unsigned int i=0; i!=v.size(); ++i) { std::vector d; g.neighbours(v[i], d); std::cout << v[i].val << " : "; for (unsigned int j=0; j!=d.size(); ++j) std::cout << d[j].val << " (" << g.label(v[i], d[j]).symbol << "); "; std::cout << std::endl; } } // graph_infos() /*---------------------------------------------------------------------------*/ /** * \brief Test the reverse iterator on vertices. */ void graph_rit_vertices( const claw::graph& g ) { std::cout << ":: reverse vertex iterator: " << std::endl; claw::graph::reverse_vertex_iterator it_s; std::cout << "=========== increment ++ (end to begin)" << std::endl; for (it_s = g.vertex_rbegin(); it_s != g.vertex_rend(); ++it_s) std::cout << *it_s << ", "; std::cout << std::endl; std::cout << "=========== decrement -- (begin to end)" << std::endl; it_s = g.vertex_rend(); do { --it_s; std::cout << *it_s << ", "; } while ( it_s != g.vertex_rbegin() ); std::cout << std::endl; } // graph_rit_vertices() /*---------------------------------------------------------------------------*/ /** * \brief Test the iterator on vertices. */ void graph_it_vertices( const claw::graph& g ) { std::cout << ":: vertex iterator: " << std::endl; claw::graph::vertex_iterator it_s; std::list v1, v2; std::cout << "=========== forward" << std::endl; for (it_s = g.vertex_begin(); it_s != g.vertex_end(); ++it_s) { std::cout << *it_s << ", "; v1.push_back(*it_s); } std::cout << std::endl; std::cout << "=========== then come back to first" << std::endl; do { --it_s; std::cout << *it_s << ", "; v2.push_front(*it_s); } while (it_s != g.vertex_begin()); std::cout << std::endl; if ( std::equal( v1.begin(), v1.end(), v2.begin() ) ) std::cout << "OK" << std::endl; else std::cout << "Problem" << std::endl; v1.clear(); v2.clear(); std::cout << "=========== backward" << std::endl; it_s = g.vertex_end(); do { --it_s; std::cout << *it_s << ", "; v1.push_front(*it_s); } while (it_s != g.vertex_begin()); std::cout << std::endl; std::cout << "=========== then come back to the end" << std::endl; for (; it_s != g.vertex_end(); ++it_s) { std::cout << *it_s << ", "; v2.push_back(*it_s); } std::cout << std::endl; if ( std::equal( v1.begin(), v1.end(), v2.begin() ) ) std::cout << "OK" << std::endl; else std::cout << "Problem" << std::endl; vertex s; std::cout << "scan from vertex="; std::cin >> s.val; std::cout << "=========== to the end" << std::endl; for (it_s=g.vertex_begin(s); it_s!=g.vertex_end(); ++it_s) std::cout << *it_s << ", "; std::cout << std::endl; std::cout << "=========== to the beginning" << std::endl; it_s=g.vertex_begin(s); if (it_s!=g.vertex_begin()) do { --it_s; std::cout << *it_s << ", "; } while( it_s != g.vertex_begin() ); std::cout << std::endl; } // graph_it_vertices() /*---------------------------------------------------------------------------*/ /** * \brief Test the reverse iterator on edges. */ void graph_rit_edges( const claw::graph& g ) { std::cout << ":: reverse edge iterator: " << std::endl; claw::graph::reverse_edge_iterator it_a; std::cout << "=========== increment ++ (end to begin)" << std::endl; for (it_a = g.edge_rbegin(); it_a != g.edge_rend(); ++it_a) std::cout << "<" << it_a->source() << "; " << it_a->label() << it_a->target() << ">, "; std::cout << std::endl; std::cout << "=========== decrement -- (begin to end)" << std::endl; it_a = g.edge_rend(); do { --it_a; std::cout << "<" << it_a->source() << "; " << it_a->label() << it_a->target() << ">, "; } while ( it_a != g.edge_rbegin() ); std::cout << std::endl; } // graph_rit_edges() /*---------------------------------------------------------------------------*/ /** * \brief Test the iterator on edges. */ void graph_it_edges( const claw::graph& g ) { std::cout << ":: edge iterator: " << std::endl; claw::graph::edge_iterator it_a; std::list v1, v2; std::cout << "=========== forward" << std::endl; for (it_a = g.edge_begin(); it_a != g.edge_end(); ++it_a) { std::cout << "<" << it_a->source() << "; " << it_a->label() << it_a->target() << ">, "; v1.push_back(it_a->label()); } std::cout << std::endl; std::cout << "=========== then come back to the first" << std::endl; do { --it_a; std::cout << "<" << it_a->source() << "; " << it_a->label() << it_a->target() << ">, "; v2.push_front(it_a->label()); } while (it_a != g.edge_begin()); std::cout << std::endl; if ( std::equal( v1.begin(), v1.end(), v2.begin() ) ) std::cout << "OK" << std::endl; else std::cout << "Problem" << std::endl; v1.clear(); v2.clear(); std::cout << "=========== backward" << std::endl; it_a = g.edge_end(); do { --it_a; std::cout << "<" << it_a->source() << "; " << it_a->label() << it_a->target() << ">, "; v1.push_front(it_a->label()); } while (it_a != g.edge_begin()); std::cout << std::endl; std::cout << "=========== then come back to the end" << std::endl; for (; it_a != g.edge_end(); ++it_a) { std::cout << "<" << it_a->source() << "; " << it_a->label() << it_a->target() << ">, "; v2.push_back(it_a->label()); } std::cout << std::endl; if ( std::equal( v1.begin(), v1.end(), v2.begin() ) ) std::cout << "OK" << std::endl; else std::cout << "Problem" << std::endl; vertex s1, s2; std::cout << "scan from the edge starting at vertex="; std::cin >> s1.val; std::cout << "and ending at vertex="; std::cin >> s2.val; std::cout << "=========== to the end" << std::endl; for (it_a=g.edge_begin(s1, s2); it_a!=g.edge_end(); ++it_a) std::cout << "<" << it_a->source() << "; " << it_a->label() << it_a->target() << ">, "; std::cout << std::endl; std::cout << "=========== to the begining" << std::endl; it_a=g.edge_begin(s1, s2); if (it_a!=g.edge_begin()) do { --it_a; std::cout << "<" << it_a->source() << "; " << it_a->label() << it_a->target() << ">, "; } while( it_a != g.edge_begin() ); std::cout << std::endl; } // graph_it_edges() /*---------------------------------------------------------------------------*/ /** * \brief Load a graph and call the test methods. */ void test_graphs( const std::string& filename ) { claw::graph g; vertex s1, s2; edge a; std::ifstream f(filename.c_str()); if (f) { while (f >> s1.val) { f >> s2.val; if (s2.val > 0) { f >> a.symbol >> a.weight; g.add_edge(s1, s2, a); } else { std::cout << s1 << ": isolated" << std::endl; g.add_vertex(s1); } } f.close(); std::cout << " ----------------------------------- informations" << std::endl; graph_infos( g ); std::cout << " ------------------------------------------ print" << std::endl; std::cout << g << std::endl; std::cout << " ------------------------------ iterator (states)" << std::endl; graph_it_vertices( g ); std::cout << " ------------------------------- iterator (edges)" << std::endl; graph_it_edges( g ); std::cout << " ---------------------- reverse iterator (states)" << std::endl; graph_rit_vertices( g ); std::cout << " ----------------------- reverse iterator (edges)" << std::endl; graph_rit_edges( g ); } } // test_graphs() int main(int argc, char* argv[]) { if (argc != 2) { std::cout << argv[0] << " test_file" << std::endl; return 1; } else { try { test_graphs(argv[1]); } catch( claw::graph_exception& e ) { std::cerr << e.what() << std::endl; } return 0; } } libclaw-1.7.4/examples/graph/mk_test.cpp000066400000000000000000000022201216507631600202340ustar00rootroot00000000000000#include #include #include #include #include int main(int argc, char* argv[]) { if (argc != 6) { std::cerr << argv[0] << " n_sommets n_isoles n_arcs symboles poids_max" << std::endl; return 1; } else { int n_sommets, n_isoles, n_arcs, poids_max; std::string symboles = argv[4]; std::istringstream iss; srand(time(NULL)); iss.str(argv[1]); iss >> n_sommets; iss.clear(); iss.str(argv[2]); iss >> n_isoles; iss.clear(); iss.str(argv[3]); iss >> n_arcs; iss.clear(); iss.str(argv[5]); iss >> poids_max; iss.clear(); for (int i=0, j=0; (i #include #include #include #include #include #include #include #include /*----------------------------------------------------------------------------*/ void save_bitmap ( const claw::graphic::image& img, const std::string& filename ) { std::ofstream f( (filename + ".bmp").c_str(), std::ios::binary ); claw::graphic::bitmap::writer( img, f ); f.close(); } /*----------------------------------------------------------------------------*/ void save_pcx ( const claw::graphic::image& img, const std::string& filename ) { std::ofstream f( (filename + ".pcx").c_str(), std::ios::binary ); claw::graphic::pcx::writer( img, f ); f.close(); } /*----------------------------------------------------------------------------*/ void save_xbm ( const claw::graphic::image& img, const std::string& filename, const std::string& name, const claw::math::coordinate_2d* hot ) { claw::graphic::xbm::writer::options opt(name, hot); std::ostringstream oss; oss << filename << '-' << name << "-"; if ( hot==NULL ) oss << "."; else oss << hot->x << ":" << hot->y; oss << ".xbm"; std::ofstream f( oss.str().c_str() ); claw::graphic::xbm::writer( img, f, opt ); f.close(); } /*----------------------------------------------------------------------------*/ void save_xbm( const claw::graphic::image& img, const std::string& filename ) { claw::math::coordinate_2d hot(10, 10); std::cout << "no hot" << std::endl; save_xbm( img, filename, "cold", NULL ); std::cout << "hot" << std::endl; save_xbm( img, filename, "hot", &hot ); } /*----------------------------------------------------------------------------*/ void save_targa ( const claw::graphic::image& img, const std::string& filename, bool rle ) { std::ostringstream oss; oss << filename << '-' << (rle ? "rle" : "raw") << ".tga"; std::ofstream f( oss.str().c_str(), std::ios::binary ); claw::graphic::targa::writer( img, f, rle ); f.close(); } /*----------------------------------------------------------------------------*/ void save_targa( const claw::graphic::image& img, const std::string& filename ) { std::cout << "compressed" << std::endl; save_targa( img, filename, true ); std::cout << "not compressed" << std::endl; save_targa( img, filename, false ); } /*----------------------------------------------------------------------------*/ void save_png ( const claw::graphic::image& img, const std::string& filename, claw::graphic::png::writer::options::compression_level comp, claw::graphic::png::writer::options::interlace_type inter ) { claw::graphic::png::writer::options opt(comp, inter); std::ostringstream oss; oss << filename << '-'; switch (comp) { case claw::graphic::png::writer::options::no_compression: oss << "none"; break; case claw::graphic::png::writer::options::best_compression: oss << "best"; break; case claw::graphic::png::writer::options::best_speed: oss << "speed"; break; case claw::graphic::png::writer::options::default_compression: oss << "default"; break; } oss << '-'; if (inter == claw::graphic::png::writer::options::none ) oss << "none"; else oss << "adam"; oss << ".png"; std::ofstream f( oss.str().c_str(), std::ios::binary ); claw::graphic::png::writer( img, f, opt ); f.close(); } /*----------------------------------------------------------------------------*/ void save_png( const claw::graphic::image& img, const std::string& filename ) { std::cout << "not compressed, not interlaced" << std::endl; save_png( img, filename, claw::graphic::png::writer::options::no_compression, claw::graphic::png::writer::options::none ); std::cout << "best compression, not interlaced" << std::endl; save_png( img, filename, claw::graphic::png::writer::options::best_compression, claw::graphic::png::writer::options::none ); std::cout << "best speed compression, not interlaced" << std::endl; save_png( img, filename, claw::graphic::png::writer::options::best_speed, claw::graphic::png::writer::options::none ); std::cout << "default compression, not interlaced" << std::endl; save_png( img, filename, claw::graphic::png::writer::options::default_compression, claw::graphic::png::writer::options::none ); std::cout << "not compressed, interlaced" << std::endl; save_png( img, filename, claw::graphic::png::writer::options::no_compression, claw::graphic::png::writer::options::adam7 ); std::cout << "best compression, interlaced" << std::endl; save_png( img, filename, claw::graphic::png::writer::options::best_compression, claw::graphic::png::writer::options::adam7 ); std::cout << "best speed compression, interlaced" << std::endl; save_png( img, filename, claw::graphic::png::writer::options::best_speed, claw::graphic::png::writer::options::adam7 ); std::cout << "default compression, interlaced" << std::endl; save_png( img, filename, claw::graphic::png::writer::options::default_compression, claw::graphic::png::writer::options::adam7 ); } /*----------------------------------------------------------------------------*/ void save_jpeg( const claw::graphic::image& img, const std::string& filename, bool progressive, unsigned int quality ) { claw::graphic::jpeg::writer::options opt; opt.progressive = progressive; opt.quality = quality; std::ostringstream oss; oss << filename << '-' << (progressive ? 'p' : '.') << '-' << quality << ".jpg"; std::ofstream f( oss.str().c_str(), std::ios::binary ); claw::graphic::jpeg::writer( img, f, opt ); f.close(); } /*----------------------------------------------------------------------------*/ void save_jpeg( const claw::graphic::image& img, const std::string& filename ) { std::cout << "non progressive, quality=1" << std::endl; save_jpeg( img, filename, false, 1 ); std::cout << "non progressive, quality=50" << std::endl; save_jpeg( img, filename, false, 50 ); std::cout << "non progressive, quality=80" << std::endl; save_jpeg( img, filename, false, 80 ); std::cout << "non progressive, quality=100" << std::endl; save_jpeg( img, filename, false, 100 ); std::cout << "progressive, quality=1" << std::endl; save_jpeg( img, filename, true, 1 ); std::cout << "progressive, quality=50" << std::endl; save_jpeg( img, filename, true, 50 ); std::cout << "progressive, quality=80" << std::endl; save_jpeg( img, filename, true, 80 ); std::cout << "progressive, quality=100" << std::endl; save_jpeg( img, filename, true, 100 ); } /*----------------------------------------------------------------------------*/ void save( const claw::graphic::image& img, const std::string& filename ) { std::cout << "== Saving pcx files ==" << std::endl; save_pcx( img, filename ); std::cout << "== Saving jpg files ==" << std::endl; save_jpeg( img, filename ); std::cout << "== Saving png files ==" << std::endl; save_png( img, filename ); std::cout << "== Saving bitmap files ==" << std::endl; save_bitmap( img, filename ); std::cout << "== Saving targa files ==" << std::endl; save_targa( img, filename ); std::cout << "== Saving xbm files ==" << std::endl; save_xbm( img, filename ); } /*----------------------------------------------------------------------------*/ std::string get_base_name( const std::string& filename ) { std::string::size_type end = filename.find_last_of('.'); std::string::size_type begin = filename.find_last_of('/'); std::string result; if ( begin != std::string::npos ) { if ( end != std::string::npos ) result = filename.substr(begin+1, end - begin - 1); else result = filename.substr(begin+1); } else if ( end != std::string::npos ) result = filename.substr(0, end); else result = filename; return result; } /*----------------------------------------------------------------------------*/ int main( int argc, char* argv[] ) { if (argc == 1) std::cerr << argv[0] << " image_file..." << std::endl; else for (int i=1; i!=argc; ++i) { std::ifstream f(argv[i], std::ios::binary); if (f) { try { claw::graphic::image img( f ); save( img, get_base_name(argv[i]) ); } catch(std::exception& e) { std::cerr << "Exception: " << e.what() << std::endl; } } else std::cerr << "can't open '" << argv[i] << "'" << std::endl; } return 0; } libclaw-1.7.4/examples/iterator/000077500000000000000000000000001216507631600166165ustar00rootroot00000000000000libclaw-1.7.4/examples/iterator/CMakeLists.txt000066400000000000000000000013151216507631600213560ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-iterator-example) # check profiling mode if( CMAKE_BUILD_TYPE MATCHES profile ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -pg" ) endif( CMAKE_BUILD_TYPE MATCHES profile ) # check DEBUG mode if( CMAKE_BUILD_TYPE MATCHES debug ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DEBUG" ) endif( CMAKE_BUILD_TYPE MATCHES debug ) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) #------------------------------------------------------------------------------- find_package(libclaw) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) add_definitions( ${CLAW_DEFINITIONS} ) add_executable( ex-iterator main.cpp ) libclaw-1.7.4/examples/iterator/main.cpp000066400000000000000000000052711216507631600202530ustar00rootroot00000000000000#include #include #include #include #include #include void bi_test() { typedef std::list< std::pair > container; container v; v.push_back( std::pair(1, 1) ); v.push_back( std::pair(2, 4) ); v.push_back( std::pair(3, 9) ); v.push_back( std::pair(4, 61) ); typedef claw::wrapped_iterator < int, container::iterator, claw::second >::iterator_type iterator; iterator it; for ( it=v.begin(); it!=v.end(); ++it ) std::cout << *it << ' '; std::cout << std::endl; do { --it; std::cout << *it << ' '; } while ( it!=v.begin() ); std::cout << std::endl; } void random_test() { typedef std::vector< std::pair > container; container v; v.push_back( std::pair(1, 1) ); v.push_back( std::pair(2, 4) ); v.push_back( std::pair(3, 9) ); v.push_back( std::pair(4, 61) ); typedef claw::wrapped_iterator < int, container::iterator, claw::second >::iterator_type iterator; iterator it; for ( it=v.begin(); it!=v.end(); ++it ) std::cout << *it << ' '; std::cout << std::endl; it = v.begin(); *(it + 3) = 18; for ( it=v.begin(); it!=v.end(); ++it ) std::cout << *it << ' '; std::cout << std::endl; *(it - 1) = 17; for ( it=v.begin(); it!=v.end(); ++it ) std::cout << *it << ' '; std::cout << std::endl; it = v.begin(); it[3] = 16; for ( it=v.begin(); it!=v.end(); ++it ) std::cout << *it << ' '; std::cout << std::endl; } void complicated_test() { typedef std::vector< std::pair* > container; container v; v.push_back( new std::pair(1, 1) ); v.push_back( new std::pair(2, 4) ); v.push_back( new std::pair(3, 9) ); v.push_back( new std::pair(4, 61) ); typedef claw::wrapped_iterator < int, container::iterator, claw::unary_compose < claw::second, claw::dereference< std::pair > > >::iterator_type iterator; iterator it; for ( it=v.begin(); it!=v.end(); ++it ) std::cout << *it << ' '; std::cout << std::endl; it = v.begin(); *(it + 3) = 18; for ( it=v.begin(); it!=v.end(); ++it ) std::cout << *it << ' '; std::cout << std::endl; *(it - 1) = 16; for ( it=v.begin(); it!=v.end(); ++it ) std::cout << *it << ' '; std::cout << std::endl; } int main( int argc, char* argv[] ) { bi_test(); std::cout << "--\n"; random_test(); std::cout << "--\n"; complicated_test(); return 0; } // int main() libclaw-1.7.4/examples/kmp/000077500000000000000000000000001216507631600155545ustar00rootroot00000000000000libclaw-1.7.4/examples/kmp/CMakeLists.txt000066400000000000000000000011621216507631600203140ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-kmp-example) # check profiling mode if( CMAKE_BUILD_TYPE MATCHES profile ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -pg" ) endif( CMAKE_BUILD_TYPE MATCHES profile ) # check DEBUG mode if( CMAKE_BUILD_TYPE MATCHES debug ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DEBUG" ) endif( CMAKE_BUILD_TYPE MATCHES debug ) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) find_package(libclaw) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) add_definitions( ${CLAW_DEFINITIONS} ) add_executable( ex-kmp main.cpp ) libclaw-1.7.4/examples/kmp/main.cpp000066400000000000000000000016441216507631600172110ustar00rootroot00000000000000/** * \file main.cpp * \brief Test program for the Knuth-Morris-Pratt algorithm. * \author Julien Jorge */ #include #include #include #include "claw/kmp.hpp" typedef std::string::const_iterator it_chaine_t; /** * \brief Predicate passed to KMP. * \param i Match position */ bool print_pos( unsigned int i ) { std::cout << "Pattern found at position " << i << std::endl; return true; } /** * \brief Main procedure. * \param argc Parameters count. Should be 3. * \param argv Parameters. argv[1] is the pattern, argv[2] is the text. */ int main(int argc, char* argv []) { if (argc < 3) { std::cerr << "./kmp pattern text" << std::endl; return 1; } else { std::string pattern = argv[1]; std::string text = argv[2]; claw::text::kmp< it_chaine_t > kmp; kmp(pattern.begin(), pattern.end(), text.begin(), text.end(), print_pos); } } libclaw-1.7.4/examples/memory/000077500000000000000000000000001216507631600162755ustar00rootroot00000000000000libclaw-1.7.4/examples/memory/CMakeLists.txt000066400000000000000000000011601216507631600210330ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-memory) # check profiling mode if( CMAKE_BUILD_TYPE MATCHES profile ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -pg" ) endif( CMAKE_BUILD_TYPE MATCHES profile ) # check DEBUG mode if( CMAKE_BUILD_TYPE MATCHES debug ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DEBUG" ) endif( CMAKE_BUILD_TYPE MATCHES debug ) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) find_package(libclaw) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) add_definitions( ${CLAW_DEFINITIONS} ) add_executable( ex-memory main.cpp ) libclaw-1.7.4/examples/memory/main.cpp000066400000000000000000000101611216507631600177240ustar00rootroot00000000000000/** * \file main.cpp * \brief Sample program presenting the use of the claw::memory namespace. * \author Julien Jorge */ #include #include #include #include #include /*----------------------------------------------------------------------------*/ /** * \brief Simple class, containing a string message. To illustrate the use of * claw::memory. */ class message { public: message( const std::string& msg ) : m_msg(msg) { } ~message() { std::cout << "deleting " << m_msg << std::endl; } const std::string& get_message() const { return m_msg; } private: std::string m_msg; }; // class message /*----------------------------------------------------------------------------*/ /** * \brief Chained structure to show the problems occuring with the use of * references count. */ struct item { claw::memory::smart_ptr next; }; // struct item /*----------------------------------------------------------------------------*/ /** * \brief Print a \a message stored in a smart_ptr. The parameter is passed by * copy. */ void print_copy( claw::memory::smart_ptr p ) { std::cout << "print_copy" << std::endl; std::cout << " (->) " << p->get_message() << std::endl; std::cout << " (*) " << (*p).get_message() << std::endl; } // print_copy() /*----------------------------------------------------------------------------*/ /** * \brief Print a \a message stored in a smart_ptr. The parameter is passed by * reference. */ void print_ref( claw::memory::smart_ptr& p ) { std::cout << "print_ref" << std::endl; std::cout << " (->) " << p->get_message() << std::endl; std::cout << " (*) " << (*p).get_message() << std::endl; } // print_ref() /*----------------------------------------------------------------------------*/ /** * \brief Print a \a message stored in a smart_ptr. The parameter is passed by * reference (to test the constant methods of smart_ptr). */ void print_const( const claw::memory::smart_ptr& p ) { std::cout << "print_const" << std::endl; std::cout << " (->) " << p->get_message() << std::endl; std::cout << " (*) " << (*p).get_message() << std::endl; } // print_const() /*----------------------------------------------------------------------------*/ /** * \brief Create some smart_ptr, call print_*() methods and do some operations. */ void basic_test() { std::cout << "----------------- basic_test" << std::endl; claw::memory::smart_ptr p = new message( "basic_1" ); claw::memory::smart_ptr q = new message( "basic_2" ); claw::memory::smart_ptr p2(p); claw::memory::smart_ptr q2; claw::memory::smart_ptr r( NULL ); print_copy(p); print_ref(p); print_const(p); std::cout << "instruction: p = p = p" << std::endl; p = p = p; std::cout << "instruction: q2 = q" << std::endl; q2 = q; } // basic_test() /*----------------------------------------------------------------------------*/ /** * \brief Use a smart_ptr with a class from the STL. */ void stl_test() { std::cout << "----------------- stl_test" << std::endl; std::list< claw::memory::smart_ptr > list; std::list< claw::memory::smart_ptr >::const_iterator it; for ( unsigned int i=0; i!=10; ++i ) { std::ostringstream oss; oss << i; list.push_back( new message(oss.str()) ); } for ( it=list.begin(); it!=list.end(); ++it ) std::cout << (*it)->get_message(); std::cout << std::endl; } // stl_test() /*----------------------------------------------------------------------------*/ /** * \brief Example of the problems occuring with the use of references count. */ void loop_test() { std::cout << "----------------- loop_test" << std::endl; claw::memory::smart_ptr i1 = new item; claw::memory::smart_ptr i2 = new item; i2->next = i1; i1->next = i2; } // test_boucle() /*----------------------------------------------------------------------------*/ /** * \brief Main program. Call test methods. */ int main() { basic_test(); stl_test(); loop_test(); return 0; } // main() libclaw-1.7.4/examples/multi_type_map/000077500000000000000000000000001216507631600200155ustar00rootroot00000000000000libclaw-1.7.4/examples/multi_type_map/CMakeLists.txt000066400000000000000000000012001216507631600225460ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-multi_type_map) # check profiling mode if( CMAKE_BUILD_TYPE MATCHES profile ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -pg" ) endif( CMAKE_BUILD_TYPE MATCHES profile ) # check DEBUG mode if( CMAKE_BUILD_TYPE MATCHES debug ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DEBUG" ) endif( CMAKE_BUILD_TYPE MATCHES debug ) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) find_package(libclaw) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) add_definitions( ${CLAW_DEFINITIONS} ) add_executable( ex-multi_type_map main.cpp ) libclaw-1.7.4/examples/multi_type_map/main.cpp000066400000000000000000000104471216507631600214530ustar00rootroot00000000000000#include #include #include #include #include #include /*----------------------------------------------------------------------------*/ struct custom { int a; std::string s; custom() { } custom( int _a, const std::string& _s ) : a(_a), s(_s) { } }; // class custom /*----------------------------------------------------------------------------*/ std::ostream& operator<<( std::ostream& os, const custom& c ) { return os << "(" << c.a << ", " << c.s << ")"; } /*----------------------------------------------------------------------------*/ using namespace claw; using namespace claw::meta; /*----------------------------------------------------------------------------*/ template struct map_printer; /*----------------------------------------------------------------------------*/ template struct map_printer< multi_type_map > { std::ostream& operator() ( std::ostream& os, const multi_type_map& ) const { return os; } }; // map_printer [no_type] /*----------------------------------------------------------------------------*/ template struct map_printer< multi_type_map< Key, type_list > > { typedef multi_type_map< Key, type_list > map_type; std::ostream& operator()( std::ostream& os, const map_type& m ) const { typename map_type::template iterator::const_type it; for (it=m.template begin(); it!=m.template end(); ++it) os << "(" << it->first << ", " << it->second << ") "; os << std::endl; map_printer< multi_type_map > rec; return rec( os, m ); } }; // map_printer [no_type] /*----------------------------------------------------------------------------*/ template std::ostream& print_map ( std::ostream& os, const multi_type_map< Key, type_list >& m ) { typedef multi_type_map< Key, type_list > map_type; map_printer p; return p(os, m); } // print_map /*----------------------------------------------------------------------------*/ typedef type_list_maker::result my_type_list; typedef multi_type_map map_type; /*----------------------------------------------------------------------------*/ void fill_map( map_type& m ) { m.set( 0, false ); m.set( 1, true ); m.set( 0, 3.14 ); m.set( 1, 3.14 ); m.set( 3, 3.14 ); m.set( 5, 3.14 ); m.set( 7, 3.14 ); m.set( 9, 3.14 ); m.set( 0, custom(72, "seventy-two") ); m.set( 1, "my favorite string" ); m.set( 1, custom(24, "my favorite number") ); } // fill_map() /*----------------------------------------------------------------------------*/ void test_erase() { map_type m; fill_map(m); m.erase(0); m.erase(0); m.erase(1); map_type::iterator::type it, tmp; it = m.begin(); while ( it!=m.end() ) { tmp = it; ++it; m.erase(tmp); } std::cout << "[Test] erase" << std::endl; print_map(std::cout, m); } // test_erase() /*----------------------------------------------------------------------------*/ void test_get_set() { map_type m; fill_map(m); std::cout << "[Test] get/set" << std::endl; print_map(std::cout, m); } // test_get_set() /*----------------------------------------------------------------------------*/ void test_set_map() { map_type m; fill_map(m); map_type m2; for ( map_type::iterator::type it=m.begin(); it!=m.end(); ++it ) m2.set( 2*it->first, 2*it->second ); m.set( m2 ); std::cout << "[Test] set_map" << std::endl; print_map(std::cout, m); } // test_get_set() /*----------------------------------------------------------------------------*/ void test_size() { map_type m; fill_map(m); std::cout << "[Test] size" << std::endl; std::cout << m.size() << std::endl; } // test_size() /*----------------------------------------------------------------------------*/ int main( int argc, char* argv[] ) { test_get_set(); test_size(); test_set_map(); test_erase(); return 0; } // main() libclaw-1.7.4/examples/multi_type_map/test_files/000077500000000000000000000000001216507631600221565ustar00rootroot00000000000000libclaw-1.7.4/examples/multi_type_map/test_files/sample.txt000066400000000000000000000014641216507631600242050ustar00rootroot00000000000000# this is a test file for the example program of the # claw::multi_type_map class. # first, add some item in the map # syntax is: # # set # # where: # - key is an integer # - type is b, f, s or c for bool, float, string and custom, # respectively # - value is a value of type # # The value for the custom type is a pair of an interger and a string # set 0 b 0 set 1 b 1 set 0 f 3.14 set 0 c 72 seventy-two set 1 s my_favorite_string set 1 c 24 my_favorite_number # then, print some values # syntax is: # # get # # where: # - key is an integer # - type is b, f, s or c for bool, float, string and custom, # respectively # get 0 b get 1 b get 5 b # does not exist get 0 f get 5 f # does not exist get 0 c get 5 c # does not exist get 1 s get 5 s # does not exist get 1 c libclaw-1.7.4/examples/ordered_set/000077500000000000000000000000001216507631600172645ustar00rootroot00000000000000libclaw-1.7.4/examples/ordered_set/CMakeLists.txt000066400000000000000000000012021216507631600220170ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-ordered_set-example) # check profiling mode if( CMAKE_BUILD_TYPE MATCHES profile ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -pg" ) endif( CMAKE_BUILD_TYPE MATCHES profile ) # check DEBUG mode if( CMAKE_BUILD_TYPE MATCHES debug ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DEBUG" ) endif( CMAKE_BUILD_TYPE MATCHES debug ) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) find_package(libclaw) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) add_definitions( ${CLAW_DEFINITIONS} ) add_executable( ex-ordered_set main.cpp ) libclaw-1.7.4/examples/ordered_set/main.cpp000066400000000000000000000074631216507631600207260ustar00rootroot00000000000000/** * \file main.cpp * \brief Test program for the claw::math::ordered_set class. * \author Julien Jorge */ #include #include #include #include #include #include "claw/ordered_set.hpp" typedef claw::math::ordered_set set_type; enum operation { UNION, INTERSECTION, DIFFERENCE, SYMETRIC_DIFFERENCE, CONTAINS, STRICT_CONTAINS, CONTAINED, STRICT_CONTAINED }; // enum operation void result( bool b ) { if (b) std::cout << "yes" << std::endl; else std::cout << "no" << std::endl; } void result( const set_type& s ) { set_type::const_iterator it; std::cout << "{ "; for (it = s.begin(); it != s.end(); ++it) std::cout << *it << ", "; std::cout << "}" << std::endl; } void help() { std::cerr << "ordered_set value... op value..." << std::endl; std::cerr << "with :" << std::endl; std::cerr << "value : an unsigned integers." << std::endl; std::cerr << "op : one string in { union, intersection, difference, " "symetric_difference, contains, strictly_contains, contained, " "strictly_contained }." << std::endl; } void apply_op( operation op, set_type& s1, const set_type& s2 ) { switch( op ) { case UNION : std::cout << "union:"; result( s1 += s2 ); break; case INTERSECTION : std::cout << "intersection:"; result( s1 *= s2 ); break; case DIFFERENCE : std::cout << "difference:"; result( s1 -= s2 ); break; case SYMETRIC_DIFFERENCE : std::cout << "symetric_difference:"; result( s1 /= s2 ); break; case CONTAINS : std::cout << "contains:"; result( s1 >= s2 ); break; case STRICT_CONTAINS : std::cout << "strictly_contains:"; result( s1 > s2 ); break; case CONTAINED : std::cout << "contained:"; result( s1 <= s2 ); break; case STRICT_CONTAINED : std::cout << "strictly_contained:"; result( s1 < s2 ); break; } } /** * \brief Main procedure. * \param argc Parameters count. Should be 3. * \param argv Parameters. argv[1] is the pattern, argv[2] is the text. */ int main(int argc, char* argv []) { if (argc < 3) { help(); return EXIT_FAILURE; } else { set_type left, right; unsigned int current_set = 0; operation op = UNION; for (int argi=1; argi!=argc; ++argi) if ( (argv[argi][0] >= '0') && (argv[argi][0] <= '9') ) { std::istringstream iss(argv[argi]); unsigned int val; iss >> val; current_set == 0 ? left.insert(val) : right.insert(val); } else if ( current_set != 0 ) { std::cerr << argv[argi] << std::endl; help(); exit( EXIT_FAILURE ); } else { std::string arg(argv[argi]); current_set = 1; if ( arg == "union" ) op = UNION; else if ( arg == "intersection" ) op = INTERSECTION; else if ( arg == "difference" ) op = DIFFERENCE; else if ( arg == "symetric_difference" ) op = SYMETRIC_DIFFERENCE; else if ( arg == "contains" ) op = CONTAINS; else if ( arg == "strictly_contains" ) op = STRICT_CONTAINS; else if ( arg == "contained" ) op = CONTAINED; else if ( arg == "strictly_contained" ) op = STRICT_CONTAINED; else { std::cerr << arg << std::endl; help(); exit( EXIT_FAILURE ); } } result(left); result(right); apply_op( op, left, right ); } return EXIT_SUCCESS; } libclaw-1.7.4/examples/singleton/000077500000000000000000000000001216507631600167675ustar00rootroot00000000000000libclaw-1.7.4/examples/singleton/CMakeLists.txt000066400000000000000000000011761216507631600215340ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-singleton-example) # check profiling mode if( CMAKE_BUILD_TYPE MATCHES profile ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -pg" ) endif( CMAKE_BUILD_TYPE MATCHES profile ) # check DEBUG mode if( CMAKE_BUILD_TYPE MATCHES debug ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DEBUG" ) endif( CMAKE_BUILD_TYPE MATCHES debug ) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) find_package(libclaw) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) add_definitions( ${CLAW_DEFINITIONS} ) add_executable( ex-singleton main.cpp ) libclaw-1.7.4/examples/singleton/main.cpp000066400000000000000000000011401216507631600204130ustar00rootroot00000000000000#include #include #include class resource_manager : public claw::concept::basic_singleton { public: void print( const std::string& s ) const { std::cout << s << std::endl; } }; // class resource_manager int main() { resource_manager::get_instance().print( "The instance is just allocated" ); resource_manager::get_instance().print( "One more sentence" ); resource_manager::get_instance().print( "The instance will be deleted at the " "end of the program" ); return 0; } // main() libclaw-1.7.4/examples/sockets/000077500000000000000000000000001216507631600164405ustar00rootroot00000000000000libclaw-1.7.4/examples/sockets/CMakeLists.txt000066400000000000000000000017021216507631600212000ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-sockets-example) # check profiling mode if( CMAKE_BUILD_TYPE MATCHES profile ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -pg" ) endif( CMAKE_BUILD_TYPE MATCHES profile ) # check DEBUG mode if( CMAKE_BUILD_TYPE MATCHES debug ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DEBUG" ) endif( CMAKE_BUILD_TYPE MATCHES debug ) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) #------------------------------------------------------------------------------- # look for libraries find_package(libclaw) add_definitions( ${CLAW_DEFINITIONS} ) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) link_directories( ${CLAW_LINK_DIRECTORY} ) add_executable( ex-sockets sockets.cpp application.cpp ) target_link_libraries( ex-sockets ${CLAW_APPLICATION_LIBRARIES} ${CLAW_NET_LIBRARIES} ) if(WIN32) target_link_libraries( ex-sockets wsock32 ) endif(WIN32) libclaw-1.7.4/examples/sockets/application.cpp000066400000000000000000000107741216507631600214600ustar00rootroot00000000000000#include "application.hpp" #include #include /*----------------------------------------------------------------------------*/ ex_sockets::ex_sockets( int& argc, char** &argv ) : claw::application(argc, argv), m_quit(false), m_delay(10) { check_arguments( argc, argv ); } // ex_sockets::ex_sockets() /*----------------------------------------------------------------------------*/ int ex_sockets::run() { if (!m_quit) { if ( !claw::net::socket_server::init() ) std::cerr << "Socket initialization problem." << std::endl; else if (m_server) run_server(); else run_client(); claw::net::socket_server::release(); } return 0; } // ex_sockets::run() /*----------------------------------------------------------------------------*/ /** * \brief Check program arguments. * \param argc Number of program arguments. * \param argv Program arguments. */ void ex_sockets::check_arguments( int& argc, char** &argv ) { m_arguments.add_long("--ip", "IP to connect to.", true, "address"); m_arguments.add_long("--port", "Port to listen/connect to.", false, "integer"); m_arguments.add_long("--server", "Launch a server.", true); m_arguments.add_long("--delay", "Timeout (seconds).", true, "integer"); m_arguments.add("-h", "--help", "Print this message and exit.", true); m_arguments.parse( argc, argv ); if ( m_arguments.get_bool("-h") || !m_arguments.has_value("--port") ) { m_arguments.help(); m_quit = true; } else { m_server = m_arguments.get_bool("--server"); if ( !m_server ) { if ( m_arguments.has_value("--ip") ) m_ip = m_arguments.get_string("--ip"); else { std::cerr << "You must provide an IP to connect to." << std::endl; m_quit = true; } } if ( !m_quit ) { if ( claw::text::is_of_type ( m_arguments.get_string("--port") ) ) m_port = m_arguments.get_integer("--port"); else { std::cerr << "'" << m_arguments.get_string("--port") << "' is not a valid port." << std::endl; m_quit = true; } if ( m_arguments.has_value("--delay") ) { if ( claw::text::is_of_type ( m_arguments.get_string("--delay") )) m_delay = m_arguments.get_integer("--delay"); else { std::cerr << "'" << m_arguments.get_string("--delay") << "' is not a valid delay." << std::endl; m_quit = true; } } for (int i=0; i!=argc; ++i) m_message.push_back(argv[i]); } } } // ex_sockets::check_arguments() /*----------------------------------------------------------------------------*/ void ex_sockets::run_server() const { claw::net::socket_server server(m_port); claw::net::isocket_stream sock; if (server) server.accept( sock, m_delay ); else std::cout << "No server" << std::endl; if (!sock.is_open()) std::cout << "No socket" << std::endl; else { size_t l; std::string msg; bool fail=false; do { if (sock >> l) std::cout << l << ":"; else { fail=true; std::cerr << "ERROR: getting l" << std::endl; } if ( std::getline(sock, msg) ) { std::cout << "'" << msg << "'" << std::endl; } else { fail=true; std::cerr << "ERROR: getting msg" << std::endl; } } while( (msg != "stop") && !fail ); sock.close(); } server.close(); } // ex_sockets::run_server() /*----------------------------------------------------------------------------*/ void ex_sockets::run_client() const { claw::net::osocket_stream sock(m_ip.c_str(), m_port); if (!sock) std::cerr << "ERREUR: osocket_stream" << std::endl; else { for (unsigned int i=0; i!=m_message.size(); ++i) { if ( !(sock << m_message[i].length()) ) std::cerr << "error sending length.\n"; else if ( !(sock << m_message[i])) std::cerr << "error sending message.\n"; sock << std::endl; } sock.close(); } } // ex_sockets::run_client() libclaw-1.7.4/examples/sockets/application.hpp000066400000000000000000000010321216507631600214500ustar00rootroot00000000000000#ifndef __APPLICATION_HPP__ #define __APPLICATION_HPP__ #include #include class ex_sockets : public claw::application { public: ex_sockets( int& argc, char** &argv ); int run(); private: void check_arguments( int& argc, char** &argv ); void run_server() const; void run_client() const; private: bool m_quit; bool m_server; std::string m_ip; unsigned int m_port; unsigned int m_delay; std::vector m_message; }; // class ex_sockets #endif // __APPLICATION_HPP__ libclaw-1.7.4/examples/sockets/sockets.cpp000066400000000000000000000001031216507631600206110ustar00rootroot00000000000000#include "application.hpp" CLAW_APPLICATION_IMPLEMENT(ex_sockets) libclaw-1.7.4/examples/string_algorithm/000077500000000000000000000000001216507631600203415ustar00rootroot00000000000000libclaw-1.7.4/examples/string_algorithm/CMakeLists.txt000066400000000000000000000012301216507631600230750ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-string_algorithm-example) # check profiling mode if( CMAKE_BUILD_TYPE MATCHES profile ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -pg" ) endif( CMAKE_BUILD_TYPE MATCHES profile ) # check DEBUG mode if( CMAKE_BUILD_TYPE MATCHES debug ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DEBUG" ) endif( CMAKE_BUILD_TYPE MATCHES debug ) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) find_package(libclaw) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) add_definitions( ${CLAW_DEFINITIONS} ) add_executable( ex-string_algorithm string_algorithm.cpp ) libclaw-1.7.4/examples/string_algorithm/string_algorithm.cpp000066400000000000000000000017231216507631600244240ustar00rootroot00000000000000#include #include #include int main() { std::string ui("24"); std::string s( "\t word aaa bbb abab aaa \t "); std::string s1(s); std::string s2(s); std::string s3(s); claw::text::trim_left( s1, " \t" ); claw::text::trim_right( s2, " \t" ); claw::text::trim( s3, " \t" ); std::cout << ui << " is of type uinsigned int : " << claw::text::is_of_type(ui) << std::endl; std::cout << "trim_left '" << s << "' = '" << s1 << "'" << std::endl; std::cout << "trim_right '" << s << "' = '" << s2 << "'" << std::endl; std::cout << "trim '" << s << "' = '" << s3 << "'" << std::endl; std::string s4(s3); claw::text::squeeze( s4, "ab" ); std::cout << "squeeze '" << s3 << "' = '" << s4 << "'" << std::endl; s4 = s; claw::text::replace( s4, std::string("ab"), std::string("C") ); std::cout << "replace '" << s << "' = '" << s4 << "'" << std::endl; return 0; } libclaw-1.7.4/examples/system/000077500000000000000000000000001216507631600163115ustar00rootroot00000000000000libclaw-1.7.4/examples/system/CMakeLists.txt000066400000000000000000000013111216507631600210450ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-system-example) # check profiling mode if( CMAKE_BUILD_TYPE MATCHES profile ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -pg" ) endif( CMAKE_BUILD_TYPE MATCHES profile ) # check DEBUG mode if( CMAKE_BUILD_TYPE MATCHES debug ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DEBUG" ) endif( CMAKE_BUILD_TYPE MATCHES debug ) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) #------------------------------------------------------------------------------- find_package(libclaw) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) add_definitions( ${CLAW_DEFINITIONS} ) add_executable( ex-system main.cpp ) libclaw-1.7.4/examples/system/main.cpp000066400000000000000000000011651216507631600177440ustar00rootroot00000000000000#include #include int main( int argc, char* argv[] ) { std::cout << "your name: '" << claw::system_info::get_user_name() << "'\n"; std::cout << "your directory: '" << claw::system_info::get_user_directory() << "'\n"; std::cout << "host name: '" << claw::system_info::get_host_name() << "'\n"; std::cout << "temp directory: '" << claw::system_info::get_temporary_directory() << "'\n"; for (int i=1; i #include int main() { const std::string filename = "words.txt"; std::ifstream text(filename.c_str()); if (!text) std::cerr << "Can't open file '" << filename << "'" << std::endl; else { std::string word; claw::trie dictionary; while ( text >> word ) dictionary.insert(word.begin(), word.end()); text.close(); std::cout << dictionary.size() << " words." << std::endl; if (dictionary.empty()) std::cout << "Dictionary is empty but shouldn't !!\n" << std::endl; else std::cout << "Dictionary is not empty.\n" << std::endl; claw::trie dictionary_copy(dictionary); dictionary.clear(); if (dictionary.empty()) std::cout << "Dictionary is empty.\n" << std::endl; else std::cout << "Dictionary is not empty but should !\n" << std::endl; std::cout << "Dictionary copy" << std::endl; std::cout << dictionary_copy.size() << " words.\n" << std::endl; if (dictionary_copy.empty()) std::cout << "Dictionary is empty but shouldn't !!" << std::endl; else std::cout << "Dictionary is not empty" << std::endl; std::cout << "Type a word to get how many times it's in the text, "; std:: cout << "quit' to quit" << std::endl; do { std::cin >> word; std::cout << word << " is present " << dictionary_copy.count(word.begin(), word.end()) << " times." << std::endl; } while (word != "quit"); } return 0; } // main() libclaw-1.7.4/examples/trie/words.txt000066400000000000000000000154161216507631600176360ustar00rootroot00000000000000Who s there Nay answer me stand and unfold yourself Long live the king Bernardo He You come most carefully upon your hour Tis now struck twelve Get thee to bed Francisco For this relief much thanks tis bitter cold And I am sick at heart Have you had quiet guard Not a mouse stirring Well good night If you do meet Horatio and Marcellus The rivals of my watch bid them make haste I think I hear them Stand ho Who is there Enter Horatio and Marcellus Friends to this ground And liegemen to the Dane Give you good night O farewell honest soldier Who hath reliev d you Bernardo has my place Give you good night Exit Holla Bernardo Say What is Horatio there A piece of him Welcome Horatio Welcome good Marcellus What has this thing appear d again to night I have seen nothing Horatio says tis but our fantasy And will not let belief take hold of him Touching this dreaded sight twice seen of us Therefore I have entreated him along With us to watch the minutes of this night That if again this apparition come He may approve our eyes and speak to it Tush tush twill not appear Sit down awhile And let us once again assail your ears That are so fortified against our story What we two nights have seen Well sit we down And let us hear Bernardo speak of this Last night of all When yond same star that s westward from the pole Had made his course to illume that part of heaven Where now it burns Marcellus and myself The bell then beating one Peace break thee off look where it comes again Enter Ghost armed In the same figure like the king that s dead Thou art a scholar speak to it Horatio Looks it not like the King mark it Horatio Most like it harrows me with fear and wonder It would be spoke to Question it Horatio What art thou that usurp st this time of night Together with that fair and warlike form In which the majesty of buried Denmark Did sometimes march By heaven I charge thee speak It is offended See it stalks away Stay speak speak I charge thee speak Exit Ghost Tis gone and will not answer How now Horatio You tremble and look pale Is not this something more than fantasy What think you on t Before my God I might not this believe Without the sensible and true avouch Of mine own eyes Is it not like the King As thou art to thyself Such was the very armour he had on When he the ambitious Norway combated So frown d he once when in an angry parle He smote the sledded Polacks on the ice Tis strange Thus twice before and jump at this dead hour With martial stalk hath he gone by our watch In what particular thought to work I know not But in the gross and scope of my opinion This bodes some strange eruption to our state Good now sit down and tell me he that knows Why this same strict and most observant watch So nightly toils the subject of the land And why such daily cast of brazen cannon And foreign mart for implements of war Why such impress of shipwrights whose sore task Does not divide the Sunday from the week What might be toward that this sweaty haste Doth make the night joint labourer with the day Who is t that can inform me That can I At least the whisper goes so Our last king Whose image even but now appear d to us Was as you know by Fortinbras of Norway Thereto prick d on by a most emulate pride Dar d to the combat in which our valiant Hamlet For so this side of our known world esteem d him Did slay this Fortinbras who by a seal d compact Well ratified by law and heraldry Did forfeit with his life all those his lands Which he stood seiz d of to the conqueror Against the which a moiety competent Was gaged by our king which had return d To the inheritance of Fortinbras Had he been vanquisher as by the same cov nant And carriage of the article design d His fell to Hamlet Now sir young Fortinbras Of unimproved mettle hot and full Hath in the skirts of Norway here and there Shark d up a list of lawless resolutes For food and diet to some enterprise That hath a stomach in t which is no other As it doth well appear unto our state But to recover of us by strong hand And terms compulsatory those foresaid lands So by his father lost and this I take it Is the main motive of our preparations The source of this our watch and the chief head Of this post haste and romage in the land I think it be no other but e en so Well may it sort that this portentous figure Comes armed through our watch so like the king That was and is the question of these wars A mote it is to trouble the mind s eye In the most high and palmy state of Rome A little ere the mightiest Julius fell The graves stood tenantless and the sheeted dead Did squeak and gibber in the Roman streets As stars with trains of fire and dews of blood Disasters in the sun and the moist star Upon whose influence Neptune s empire stands Was sick almost to doomsday with eclipse And even the like precurse of fierce events As harbingers preceding still the fates And prologue to the omen coming on Have heaven and earth together demonstrated Unto our climature and countrymen But soft behold lo where it comes again Re enter Ghost I ll cross it though it blast me Stay illusion If thou hast any sound or use of voice Speak to me If there be any good thing to be done That may to thee do ease and race to me Speak to me If thou art privy to thy country s fate Which happily foreknowing may avoid O speak Or if thou hast uphoarded in thy life Extorted treasure in the womb of earth For which they say you spirits oft walk in death The cock crows Speak of it stay and speak Stop it Marcellus Shall I strike at it with my partisan Do if it will not stand Tis here Tis here Tis gone Exit Ghost We do it wrong being so majestical To offer it the show of violence For it is as the air invulnerable And our vain blows malicious mockery It was about to speak when the cock crew And then it started like a guilty thing Upon a fearful summons I have heard The cock that is the trumpet to the morn Doth with his lofty and shrill sounding throat Awake the god of day and at his warning Whether in sea or fire in earth or air The extravagant and erring spirit hies To his confine and of the truth herein This present object made probation It faded on the crowing of the cock Some say that ever gainst that season comes Wherein our Saviour s birth is celebrated The bird of dawning singeth all night long And then they say no spirit dare stir abroad The nights are wholesome then no planets strike No fairy takes nor witch hath power to charm So hallow d and so gracious is the time So have I heard and do in part believe it But look the morn in russet mantle clad Walks o er the dew of yon high eastward hill Break we our watch up and by my advice Let us impart what we have seen to night Unto young Hamlet for upon my life This spirit dumb to us will speak to him Do you consent we shall acquaint him with it As needful in our loves fitting our duty Let s do t I pray and I this morning know Where we shall find him most convenientlylibclaw-1.7.4/examples/tween/000077500000000000000000000000001216507631600161075ustar00rootroot00000000000000libclaw-1.7.4/examples/tween/CMakeLists.txt000066400000000000000000000007771216507631600206620ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) project(claw-tween-example) # common flags set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -pedantic -Wall" ) #------------------------------------------------------------------------------- # look for libraries find_package(libclaw) add_definitions( ${CLAW_DEFINITIONS} ) include_directories( ${CLAW_INCLUDE_DIRECTORY} ) link_directories( ${CLAW_LINK_DIRECTORY} ) add_executable( ex-tween main.cpp ) target_link_libraries( ex-tween ${CLAW_TWEEN_LIBRARIES} ) libclaw-1.7.4/examples/tween/Makefile000066400000000000000000000111641216507631600175520ustar00rootroot00000000000000# CMAKE generated file: DO NOT EDIT! # Generated by "Unix Makefiles" Generator, CMake Version 2.8 # Default target executed when no arguments are given to make. default_target: all .PHONY : default_target #============================================================================= # Special targets provided by cmake. # Disable implicit rules so canoncical targets will work. .SUFFIXES: # Remove some rules from gmake that .SUFFIXES does not remove. SUFFIXES = .SUFFIXES: .hpux_make_needs_suffix_list # Suppress display of executed commands. $(VERBOSE).SILENT: # A target that is always out of date. cmake_force: .PHONY : cmake_force #============================================================================= # Set environment variables for the build. # The shell in which to execute make rules. SHELL = /bin/sh # The CMake executable. CMAKE_COMMAND = /usr/bin/cmake # The command to remove a file. RM = /usr/bin/cmake -E remove -f # The top-level source directory on which CMake was run. CMAKE_SOURCE_DIR = /home/julien/Programmation/libclaw/library/examples/tween # The top-level build directory on which CMake was run. CMAKE_BINARY_DIR = /home/julien/Programmation/libclaw/library/examples/tween #============================================================================= # Targets provided globally by CMake. # Special rule for the target edit_cache edit_cache: @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running interactive CMake command-line interface..." /usr/bin/cmake -i . .PHONY : edit_cache # Special rule for the target edit_cache edit_cache/fast: edit_cache .PHONY : edit_cache/fast # Special rule for the target rebuild_cache rebuild_cache: @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." /usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) .PHONY : rebuild_cache # Special rule for the target rebuild_cache rebuild_cache/fast: rebuild_cache .PHONY : rebuild_cache/fast # The main all target all: cmake_check_build_system $(CMAKE_COMMAND) -E cmake_progress_start /home/julien/Programmation/libclaw/library/examples/tween/CMakeFiles /home/julien/Programmation/libclaw/library/examples/tween/CMakeFiles/progress.marks $(MAKE) -f CMakeFiles/Makefile2 all $(CMAKE_COMMAND) -E cmake_progress_start /home/julien/Programmation/libclaw/library/examples/tween/CMakeFiles 0 .PHONY : all # The main clean target clean: $(MAKE) -f CMakeFiles/Makefile2 clean .PHONY : clean # The main clean target clean/fast: clean .PHONY : clean/fast # Prepare targets for installation. preinstall: all $(MAKE) -f CMakeFiles/Makefile2 preinstall .PHONY : preinstall # Prepare targets for installation. preinstall/fast: $(MAKE) -f CMakeFiles/Makefile2 preinstall .PHONY : preinstall/fast # clear depends depend: $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 .PHONY : depend #============================================================================= # Target rules for targets named ex-tween # Build rule for target. ex-tween: cmake_check_build_system $(MAKE) -f CMakeFiles/Makefile2 ex-tween .PHONY : ex-tween # fast build rule for target. ex-tween/fast: $(MAKE) -f CMakeFiles/ex-tween.dir/build.make CMakeFiles/ex-tween.dir/build .PHONY : ex-tween/fast main.o: main.cpp.o .PHONY : main.o # target to build an object file main.cpp.o: $(MAKE) -f CMakeFiles/ex-tween.dir/build.make CMakeFiles/ex-tween.dir/main.cpp.o .PHONY : main.cpp.o main.i: main.cpp.i .PHONY : main.i # target to preprocess a source file main.cpp.i: $(MAKE) -f CMakeFiles/ex-tween.dir/build.make CMakeFiles/ex-tween.dir/main.cpp.i .PHONY : main.cpp.i main.s: main.cpp.s .PHONY : main.s # target to generate assembly for a file main.cpp.s: $(MAKE) -f CMakeFiles/ex-tween.dir/build.make CMakeFiles/ex-tween.dir/main.cpp.s .PHONY : main.cpp.s # Help Target help: @echo "The following are some of the valid targets for this Makefile:" @echo "... all (the default if no target is provided)" @echo "... clean" @echo "... depend" @echo "... edit_cache" @echo "... ex-tween" @echo "... rebuild_cache" @echo "... main.o" @echo "... main.i" @echo "... main.s" .PHONY : help #============================================================================= # Special targets to cleanup operation of make. # Special rule to run CMake to check the build system integrity. # No rule that depends on this can have commands that come from listfiles # because they might be regenerated. cmake_check_build_system: $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 .PHONY : cmake_check_build_system libclaw-1.7.4/examples/tween/main.cpp000066400000000000000000000110101216507631600175300ustar00rootroot00000000000000/* CLAW - a C++ Library Absolutely Wonderful CLAW is a free library without any particular aim but being useful to anyone. Copyright (C) 2005-2011 Julien Jorge This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA contact: julien.jorge@gamned.org */ #include "claw/tween/single_tweener.hpp" #include "claw/tween/easing/easing_back.hpp" #include "claw/tween/easing/easing_bounce.hpp" #include "claw/tween/easing/easing_circ.hpp" #include "claw/tween/easing/easing_cubic.hpp" #include "claw/tween/easing/easing_elastic.hpp" #include "claw/tween/easing/easing_expo.hpp" #include "claw/tween/easing/easing_linear.hpp" #include "claw/tween/easing/easing_none.hpp" #include "claw/tween/easing/easing_quad.hpp" #include "claw/tween/easing/easing_quart.hpp" #include "claw/tween/easing/easing_quint.hpp" #include "claw/tween/easing/easing_sine.hpp" #include #include #include class tester { public: void run ( std::ostream& output, double init, double end, double duration, claw::tween::single_tweener::easing_function e ); void run_ref ( std::ostream& output, double init, double end, double duration, claw::tween::single_tweener::easing_function e ); private: void print_val( double d ) const; private: double m_date; std::ostream* m_output; }; // class tester void tester::print_val( double d ) const { *m_output << m_date << '\t' << d << std::endl; } // print_val() void tester::run ( std::ostream& output, double init, double end, double duration, claw::tween::single_tweener::easing_function e ) { claw::tween::single_tweener t (init, end, duration, boost::bind(&tester::print_val, this, _1), e ); m_output = &output; m_date = 0; t.update(0); while ( !t.is_finished() ) { m_date += 0.1; t.update(0.1); } } // run() void tester::run_ref ( std::ostream& output, double init, double end, double duration, claw::tween::single_tweener::easing_function e ) { double val(0); claw::tween::single_tweener t(val, end, duration, e ); m_output = NULL; m_date = 0; t.update(0); while ( !t.is_finished() ) { m_date += 0.1; t.update(0.1); output << m_date << '\t' << val << std::endl; } } // run_ref() template void test() { tester t; std::ofstream f("in.plot"); t.run( f, 0, 1, 10, Easing::ease_in ); f.close(); f.open("out.plot"); t.run( f, 0, 1, 10, Easing::ease_out ); f.close(); f.open("inout.plot"); t.run( f, 0, 1, 10, Easing::ease_in_out ); f.close(); f.open("ref-inout.plot"); t.run( f, 0, 1, 10, Easing::ease_in_out ); } // test() int main( int argc, char* argv[] ) { if ( argc != 2 ) { std::cerr << "usage: " << argv[0] << " easing" << std::endl; std::cerr << "where easing is one of: none, back, bounce, circ, cubic, elastic, expo, linear, quad, quart, quint, " << "sine"; std::cerr << std::endl; return 1; } const std::string easing(argv[1]); if ( easing == "none" ) test(); else if ( easing == "back" ) test(); else if ( easing == "bounce" ) test(); else if ( easing == "circ" ) test(); else if ( easing == "cubic" ) test(); else if ( easing == "elastic" ) test(); else if ( easing == "expo" ) test(); else if ( easing == "linear" ) test(); else if ( easing == "quad" ) test(); else if ( easing == "quart" ) test(); else if ( easing == "quint" ) test(); else if ( easing == "sine" ) test(); else std::cerr << "Unknown easing type: '" << easing << "'." << std::endl; return 0; } libclaw-1.7.4/examples/tween/mkall.sh000066400000000000000000000003451216507631600175450ustar00rootroot00000000000000#!/bin/sh for easing in $(./ex-tween 2>&1 | tail -1 | cut -d: -f2- | tr -d ',') do ./ex-tween $easing gnuplot mkpng.gp mv in.png $easing-in.png mv out.png $easing-out.png mv inout.png $easing-inout.png done libclaw-1.7.4/examples/tween/mkpng.gp000066400000000000000000000111651216507631600175570ustar00rootroot00000000000000#!/usr/bin/gnuplot -persist # # # G N U P L O T # Version 4.4 patchlevel 2 # last modified Wed Sep 22 12:10:34 PDT 2010 # System: Linux 2.6.38-8-generic # # Copyright (C) 1986-1993, 1998, 2004, 2007-2010 # Thomas Williams, Colin Kelley and many others # # gnuplot home: http://www.gnuplot.info # faq, bugs, etc: type "help seeking-assistance" # immediate help: type "help" # plot window: hit 'h' # set terminal wxt 0 # set output unset clip points set clip one unset clip two set bar 1.000000 front unset border set xdata set ydata set zdata set x2data set y2data set timefmt x "%d/%m/%y,%H:%M" set timefmt y "%d/%m/%y,%H:%M" set timefmt z "%d/%m/%y,%H:%M" set timefmt x2 "%d/%m/%y,%H:%M" set timefmt y2 "%d/%m/%y,%H:%M" set timefmt cb "%d/%m/%y,%H:%M" set boxwidth set style fill empty border set style rectangle back fc lt -3 fillstyle solid 1.00 border lt -1 set style circle radius graph 0.02, first 0, 0 set dummy x,y set format x "% g" set format y "% g" set format x2 "% g" set format y2 "% g" set format z "% g" set format cb "% g" set angles radians unset grid set key title "" set key inside right top vertical Right noreverse enhanced autotitles nobox set key noinvert samplen 4 spacing 1 width 0 height 0 unset key unset label unset arrow set style increment default unset style line unset style arrow set style histogram clustered gap 2 title offset character 0, 0, 0 unset logscale set offsets 0, 0, 0, 0 set pointsize 1 set encoding default unset polar unset parametric unset decimalsign set view 60, 30, 1, 1 set samples 100, 100 set isosamples 10, 10 set surface unset contour set clabel '%8.3g' set mapping cartesian set datafile separator whitespace unset hidden3d set cntrparam order 4 set cntrparam linear set cntrparam levels auto 5 set cntrparam points 5 set size ratio 0 1,1 set origin 0,0 set style data points set style function lines set xzeroaxis linetype -2 linewidth 1.000 set yzeroaxis linetype -2 linewidth 1.000 set zzeroaxis linetype -2 linewidth 1.000 set x2zeroaxis linetype -2 linewidth 1.000 set y2zeroaxis linetype -2 linewidth 1.000 set ticslevel 0.5 set mxtics default set mytics default set mztics default set mx2tics default set my2tics default set mcbtics default set noxtics set noytics set noztics set nox2tics set noy2tics set nocbtics set title "" set title offset character 0, 0, 0 font "" norotate set timestamp bottom set timestamp "" set timestamp offset character 0, 0, 0 font "" norotate set rrange [ * : * ] noreverse nowriteback # (currently [8.98847e+307:-8.98847e+307] ) set trange [ * : * ] noreverse nowriteback # (currently [-5.00000:5.00000] ) set urange [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] ) set vrange [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] ) set xlabel "" set xlabel offset character 0, 0, 0 font "" textcolor lt -1 norotate set x2label "" set x2label offset character 0, 0, 0 font "" textcolor lt -1 norotate set xrange [ 0.00000 : 10.0000 ] noreverse nowriteback set x2range [ * : * ] noreverse nowriteback # (currently [0.00000:10.0000] ) set ylabel "" set ylabel offset character 0, 0, 0 font "" textcolor lt -1 rotate by -270 set y2label "" set y2label offset character 0, 0, 0 font "" textcolor lt -1 rotate by -270 set yrange [ * : * ] noreverse nowriteback # (currently [0.0157073:1.00000] ) set y2range [ * : * ] noreverse nowriteback # (currently [0.0157073:1.00000] ) set zlabel "" set zlabel offset character 0, 0, 0 font "" textcolor lt -1 norotate set zrange [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] ) set cblabel "" set cblabel offset character 0, 0, 0 font "" textcolor lt -1 rotate by -270 set cbrange [ * : * ] noreverse nowriteback # (currently [8.98847e+307:-8.98847e+307] ) set zero 1e-08 set lmargin -1 set bmargin -1 set rmargin -1 set tmargin -1 set locale "fr_FR.UTF-8" set pm3d explicit at s set pm3d scansautomatic set pm3d interpolate 1,1 flush begin noftriangles nohidden3d corners2color mean set palette positive nops_allcF maxcolors 0 gamma 1.5 color model RGB set palette rgbformulae 7, 5, 15 set colorbox default set colorbox vertical origin screen 0.9, 0.2, 0 size screen 0.05, 0.6, 0 front bdefault set loadpath set fontpath set fit noerrorvariables GNUTERM = "wxt" set term png set output "out.png" plot 0 with lines lw 2 lc -1, 1 with lines lw 2 lc -1, \ "out.plot" with lines lw 10 lc 3 set output "in.png" plot 0 with lines lw 2 lc -1, 1 with lines lw 2 lc -1, \ "in.plot" with lines lw 10 lc 3 set output "inout.png" plot 0 with lines lw 2 lc -1, 1 with lines lw 2 lc -1, \ "inout.plot" with lines lw 10 lc 3 # EOF libclaw-1.7.4/libclaw.nsi000066400000000000000000000072031216507631600153010ustar00rootroot00000000000000; libclaw.nsi ; ; Windows installer for Claw, a C++ Library Absolutely Wonderful ;-------------------------------- ; The name of the installer Name "Claw Windows installer" ; The file to write OutFile libclaw.exe ; The default installation directory InstallDir $PROGRAMFILES\claw InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\libclaw" "UninstallString" XPStyle on SetCompressor /SOLID lzma ;-------------------------------- Page license Page components Page directory Page instfiles ;-------------------------------- LicenseData COPYING InstType Runtime InstType Development InstType Full ;-------------------------------- ; .dll files Section "Runtime libraries (required)" SectionIn 1 2 3 ; Set output path to the installation directory. SetOutPath "$INSTDIR\lib" File "*.dll" SetOutPath "$INSTDIR\share\doc" File COPYING SectionEnd ; end of "Runtime libraries" ;-------------------------------- ; .dll.a files Section "Static libraries" SectionIn 2 3 ; Set output path to the installation directory. SetOutPath "$INSTDIR\lib" File "*.dll.a" SectionEnd ; end of "Static libraries" ;-------------------------------- ; Library's headers Section "Source headers" SectionIn 2 3 ; Set output path to the installation directory. SetOutPath "$INSTDIR\include\claw" File "claw\*.hpp" ; Set output path to the installation directory. SetOutPath "$INSTDIR\include\claw\impl" File "claw\impl\*.tpp" File "claw\impl\*.ipp" ; Set output path to the installation directory. SetOutPath "$INSTDIR\include\claw\meta" File "claw\meta\*.hpp" ; Set output path to the installation directory. SetOutPath "$INSTDIR\include\claw\tween" File "claw\tween\*.hpp" ; Set output path to the installation directory. SetOutPath "$INSTDIR\include\claw\tween\easing" File "claw\tween\easing\*.hpp" ; Set output path to the installation directory. SetOutPath "$INSTDIR\include\claw\tween\easing\impl" File "claw\tween\easing\impl\*.tpp" ; Set output path to the installation directory. SetOutPath "$INSTDIR\win" File "win\definitions.txt" SectionEnd ; end of "Source headers" ;-------------------------------- ; documentation of the classes Section "Classes documentation" SectionIn 2 3 ; Set output path to the installation directory. SetOutPath "$INSTDIR\share\doc\html" File /r "doc\html\" SectionEnd ; end of "Classes documentation" ;-------------------------------- ; CMake modules for using the library Section "CMake modules" SectionIn 2 3 ; Set output path to the installation directory. SetOutPath "$INSTDIR\lib\cmake\libclaw" File "cmake-module\libclaw-config.cmake" SectionEnd ; end of "CMake modules" ;-------------------------------- ; Example programs Section "Example programs" SectionIn 3 ; Set output path to the installation directory. SetOutPath "$INSTDIR\share\doc\examples" File /r "examples\" SectionEnd ; end of "Example programs" ;-------------------------------- Section -PostInstall WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\libclaw" "DisplayName" "Claw library (uninstall)" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\libclaw" "UninstallString" '"$INSTDIR\uninst-libclaw.exe"' WriteUninstaller "uninst-libclaw.exe" SectionEnd UninstallText "Ready to uninstall Claw." ;-------------------------------- Section "Uninstall" DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\libclaw" Delete "$INSTDIR\uninst-libclaw.exe" RMDir /r "$INSTDIR\include" RMDir /r "$INSTDIR\lib" RMDir /r "$INSTDIR\share" RMDir /r "$INSTDIR\win" SectionEnd libclaw-1.7.4/win/000077500000000000000000000000001216507631600137445ustar00rootroot00000000000000libclaw-1.7.4/win/CMakeLists.txt000066400000000000000000000003211216507631600165000ustar00rootroot00000000000000configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/definitions.txt.in" "${CMAKE_CURRENT_BINARY_DIR}/definitions.txt" IMMEDIATE @ONLY) install( FILES definitions.txt DESTINATION ${CMAKE_INSTALL_PREFIX}/win )libclaw-1.7.4/win/definitions.txt.in000066400000000000000000000000241216507631600174210ustar00rootroot00000000000000@CLAW_DEFINITIONS@ libclaw-1.7.4/wine-make.sh000077500000000000000000000040361216507631600153660ustar00rootroot00000000000000#!/bin/sh # MinGW must be in your path. Edit the registry key # HKCU/Environment/PATH by typing # # wine regedit # [ -z "$WIN_PROGRAM_FILES" ] \ && WIN_PROGRAM_FILES="C:/Program Files" [ -z "$WIN_GNU_INCLUDE_DIR" ] \ && WIN_GNU_INCLUDE_DIR="$WIN_PROGRAM_FILES/GnuWin32/include" [ -z "$WIN_GNU_LIB_DIR" ] \ && WIN_GNU_LIB_DIR="$WIN_PROGRAM_FILES/GnuWin32/lib" [ -z "$WIN_BOOST_DIR" ] \ && WIN_BOOST_DIR="C:/boost_1_45_0" # Libraries paths [ -z "$WIN_JPEG_INCLUDE_DIR" ] \ && WIN_JPEG_INCLUDE_DIR="$WIN_GNU_INCLUDE_DIR" [ -z "$WIN_JPEG_LIBRARY_PATH" ] \ && WIN_JPEG_LIBRARY_PATH="$WIN_GNU_LIB_DIR/libjpeg.dll.a" [ -z "$WIN_PNG_INCLUDE_DIR" ] \ && WIN_PNG_INCLUDE_DIR="$WIN_GNU_INCLUDE_DIR" [ -z "$WIN_PNG_LIBRARY_PATH" ] \ && WIN_PNG_LIBRARY_PATH="$WIN_GNU_LIB_DIR/libpng.dll.a" [ -z "$WIN_BOOST_INCLUDE_DIR" ] \ && WIN_BOOST_INCLUDE_DIR="$WIN_BOOST_DIR" # Programs [ -z "$GETTEXT_MSGMERGE_PATH" ] \ && GETTEXT_MSGMERGE_PATH="$WIN_GNU_BIN_DIR/msgmerge.exe" [ -z "$GETTEXT_MSGFMT_PATH" ] \ && GETTEXT_MSGFMT_PATH="$WIN_GNU_BIN_DIR/msgfmt.exe" # Compilation flags [ -z "$BUILD_TYPE" ] && BUILD_TYPE=release [ -z "$INSTALL_PREFIX" ] && INSTALL_PREFIX=/tmp/install/win # Compilation rm -f CMakeCache.txt wine C:/Program\ Files/CMake\ 2.8/bin/cmake.exe -G "MinGW Makefiles" . \ -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \ -DJPEG_INCLUDE_DIR:PATH="$WIN_JPEG_INCLUDE_DIR" \ -DJPEG_LIBRARY:FILEPATH="$WIN_JPEG_LIBRARY_PATH" \ -DPNG_PNG_INCLUDE_DIR:PATH="$WIN_PNG_INCLUDE_DIR" \ -DPNG_LIBRARY:FILEPATH="$WIN_PNG_LIBRARY_PATH" \ -DBoost_INCLUDE_DIR:PATH="$WIN_BOOST_INCLUDE_DIR" \ -DGETTEXT_MSGMERGE_EXECUTABLE:FILEPATH="$GETTEXT_MSGMERGE_PATH" \ -DGETTEXT_MSGFMT_EXECUTABLE:FILEPATH="$GETTEXT_MSGFMT_PATH" \ -DCMAKE_SHARED_LINKER_FLAGS='-Wl,--enable-auto-import,--enable-stdcall-fixup' \ -DCMAKE_EXE_LINKER_FLAGS='-Wl,--enable-auto-import,--enable-stdcall-fixup' \ -DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" wine mingw32-make -i wine strip *.dll cd doc doxygen cd .. makensis "libclaw.nsi"