#include "CeylanLibtoolVersion.h"
#include "CeylanException.h"
#include "CeylanTypes.h"
#include "CeylanHeaderVersion.h"
#include <string>
#include <list>
#include <algorithm>
Go to the source code of this file.
Classes | |
class | Ceylan::UtilsException |
Exception raised by common utils services. More... | |
class | Ceylan::CommandLineParseException |
Exception raised wheneve the parsing of a command line failed, for exemple when a given option requires more arguments than available in the command line. More... | |
Namespaces | |
namespace | Ceylan |
This part of the Ceylan namespace gathers some convenient string manipulation facilities to be widely used. | |
Defines | |
#define | CHECK_CEYLAN_VERSIONS() |
Allows to ensure that the actual Ceylan library being linked with is compatible with the one expected by the code that will use it (be it a library itself or a program). | |
Typedefs | |
typedef Ceylan::Sint16 | Ceylan::ExitCode |
typedef Ceylan::Sint32 | Ceylan::KeyChar |
Corresponds to a read character. | |
Functions | |
CEYLAN_DLL const Ceylan::LibtoolVersion & | Ceylan::GetVersion () |
Returns the version of the Ceylan library currently linked. | |
Ceylan::Uint16 | Ceylan::swapBytes (Ceylan::Uint16 arg) |
Swaps the two bytes of the specified 16 bit argument. | |
CEYLAN_DLL void | Ceylan::parseCommandLineOptions (std::string &readExecutableName, std::list< std::string > &readOptions, Ceylan::Uint16 argumentCount, char **argumentVector) |
Parses arguments given to an executable (argc, argv) and translates it into an executable name and a set of option words, stored in specified list of strings. | |
CEYLAN_DLL void | Ceylan::emergencyShutdown (const std::string &message) __attribute__((noreturn)) |
Stops immediatly the program, without performing any cleanup. | |
CEYLAN_DLL bool | Ceylan::keyboardHit () |
Tells whether a key has been hit, and consequently is waiting to be read. | |
CEYLAN_DLL KeyChar | Ceylan::getChar () |
Returns a new key being hit. | |
CEYLAN_DLL KeyChar | Ceylan::waitForKey (const std::string &message=DefaultWaitForKeyMessage) |
Waits for a key to be pressed. | |
template<class T , class Element > | |
void | Ceylan::split (const T &toSplit, const Element &delimiter, std::list< T > &result) |
Template function splitting a container according to a delimiter. | |
template<class T , class Predicate > | |
void | Ceylan::split_if (const T &toSplit, Predicate &predicate, std::list< T > &result) |
CEYLAN_DLL void | Ceylan::checkpoint (const std::string &message="") |
Prints in standard output a checkpoint message, with a checkpoint count incremented at each call, starting from 1. | |
CEYLAN_DLL void | Ceylan::breakpoint (const std::string &message="") |
Prints in standard output a breakpoint message, with a breakpoint count incremented at each call, starting from 1, and then waits for the user to press a key. | |
Variables | |
CEYLAN_DLL const ExitCode | Ceylan::ExitSuccess = 0 |
Return value to be used on success. | |
CEYLAN_DLL const ExitCode | Ceylan::ExitFailure = 1 |
Return value to be used on failure (any non zero value could be used). | |
CEYLAN_DLL const ExitCode | Ceylan::ExitDebugFailure = 10 |
Return value to be used on debug assertion failure. | |
CEYLAN_DLL const std::string | Ceylan::DefaultWaitForKeyMessage |
Default string to display when waiting for a key to be hit. |
#define CHECK_CEYLAN_VERSIONS | ( | ) |
Value:
Ceylan::LibtoolVersion headerVersion( \ Ceylan::actualCeylanHeaderLibtoolVersion ) ; \ if ( ! /* library version */ \ Ceylan::GetVersion().isCompatibleWith( headerVersion ) ) \ Ceylan::emergencyShutdown( \ "Ceylan library version currently linked (" \ + Ceylan::GetVersion().toString() \ + ") is not compatible with the one read from the Ceylan " \ "header files used to compile this application (" \ + headerVersion.toString() + "), aborting." ) ;
The Ceylan version is directly encoded in the library, whereas the version expected by a user program is found in this Ceylan header file, according to the version being used to compile it.
Use this macro in your application that way: 'CHECK_CEYLAN_VERSIONS() ;' for example in the first lines of your 'main' function. Of course the main Ceylan header file ('Ceylan.h') should have been included previously.
This is a macro since it has to be evaluated within the user code environment, not when the Ceylan library is built.
Definition at line 80 of file CeylanUtils.h.