Line 1... |
Line 1... |
1 |
/*
|
1 |
/*
|
2 |
* Copyright (C) 2022 by Andreas Theofilu <andreas@theosys.at>
|
2 |
* Copyright (C) 2022 to 2025 by Andreas Theofilu <andreas@theosys.at>
|
3 |
*
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
5 |
* it under the terms of the GNU General Public License as published by
|
6 |
* the Free Software Foundation; either version 3 of the License, or
|
6 |
* the Free Software Foundation; either version 3 of the License, or
|
7 |
* (at your option) any later version.
|
7 |
* (at your option) any later version.
|
Line 399... |
Line 399... |
399 |
double getAttributeDouble(const std::string& name, std::vector<ATTRIBUTE_t>& attrs);
|
399 |
double getAttributeDouble(const std::string& name, std::vector<ATTRIBUTE_t>& attrs);
|
400 |
/**
|
400 |
/**
|
401 |
* Converts a string into a boolean.
|
401 |
* Converts a string into a boolean.
|
402 |
*
|
402 |
*
|
403 |
* @param content A string containing numbers.
|
403 |
* @param content A string containing numbers.
|
- |
|
404 |
* @param def Optional: A value which is returned in case of an error.
|
404 |
* @return Returns the boolean value.
|
405 |
* @return Returns the boolean value.
|
405 |
*/
|
406 |
*/
|
406 |
bool convertElementToBool(const std::string& content);
|
407 |
bool convertElementToBool(const std::string& content, bool def=false);
|
407 |
/**
|
408 |
/**
|
408 |
* Converts a string into an integer value.
|
409 |
* Converts a string into an integer value.
|
409 |
*
|
410 |
*
|
410 |
* @param content A string containing numbers.
|
411 |
* @param content A string containing numbers.
|
- |
|
412 |
* @param def Optional: A value which is returned in case of an error.
|
411 |
* @return On success returns the value representation of the
|
413 |
* @return On success returns the value representation of the
|
412 |
* \p content. If not convertable, TError is set and 0 is returned.
|
414 |
* \p content. If not convertable, TError is set and 0 is returned.
|
413 |
*/
|
415 |
*/
|
414 |
int convertElementToInt(const std::string& content);
|
416 |
int convertElementToInt(const std::string& content, int def=0);
|
415 |
/**
|
417 |
/**
|
416 |
* Converts a string into a long integer value.
|
418 |
* Converts a string into a long integer value.
|
417 |
*
|
419 |
*
|
418 |
* @param content A string containing numbers.
|
420 |
* @param content A string containing numbers.
|
- |
|
421 |
* @param def Optional: A value which is returned in case of an error.
|
419 |
* @return On success returns the value representation of the
|
422 |
* @return On success returns the value representation of the
|
420 |
* \p content. If not convertable, TError is set and 0 is returned.
|
423 |
* \p content. If not convertable, TError is set and 0 is returned.
|
421 |
*/
|
424 |
*/
|
422 |
long convertElementToLong(const std::string& content);
|
425 |
long convertElementToLong(const std::string& content, long def=0);
|
423 |
/**
|
426 |
/**
|
424 |
* Converts a string into a floating value.
|
427 |
* Converts a string into a floating value.
|
425 |
*
|
428 |
*
|
426 |
* @param content A string containing numbers.
|
429 |
* @param content A string containing numbers.
|
- |
|
430 |
* @param def Optional: A value which is returned in case of an error.
|
427 |
* @return On success returns the value representation of the
|
431 |
* @return On success returns the value representation of the
|
428 |
* \p content. If not convertable, TError is set and 0 is returned.
|
432 |
* \p content. If not convertable, TError is set and 0 is returned.
|
429 |
*/
|
433 |
*/
|
430 |
float convertElementToFloat(const std::string& content);
|
434 |
float convertElementToFloat(const std::string& content, float def=0.0);
|
431 |
/**
|
435 |
/**
|
432 |
* Converts a string into a double floating value.
|
436 |
* Converts a string into a double floating value.
|
433 |
*
|
437 |
*
|
434 |
* @param content A string containing numbers.
|
438 |
* @param content A string containing numbers.
|
- |
|
439 |
* @param def Optional: A value which is returned in case of an error.
|
435 |
* @return On success returns the value representation of the
|
440 |
* @return On success returns the value representation of the
|
436 |
* \p content. If not convertable, TError is set and 0 is returned.
|
441 |
* \p content. If not convertable, TError is set and 0 is returned.
|
437 |
*/
|
442 |
*/
|
438 |
double convertElementToDouble(const std::string& content);
|
443 |
double convertElementToDouble(const std::string& content, double def=0.0);
|
439 |
/**
|
444 |
/**
|
440 |
* Sets the internal pointer to the \p index. If this points to an
|
445 |
* Sets the internal pointer to the \p index. If this points to an
|
441 |
* invalid index, the method sets an error and returns FALSE.
|
446 |
* invalid index, the method sets an error and returns FALSE.
|
442 |
*
|
447 |
*
|
443 |
* @param index The index into the internal XML list.
|
448 |
* @param index The index into the internal XML list.
|
Line 460... |
Line 465... |
460 |
* has attributes, an empty list is returned.
|
465 |
* has attributes, an empty list is returned.
|
461 |
*/
|
466 |
*/
|
462 |
std::vector<ATTRIBUTE_t> getAttributes(size_t index);
|
467 |
std::vector<ATTRIBUTE_t> getAttributes(size_t index);
|
463 |
|
468 |
|
464 |
/**
|
469 |
/**
|
- |
|
470 |
* @brief bool isElementTypeStart(size_t index)
|
- |
|
471 |
* Test the element the index is pointing to, for the type START.
|
- |
|
472 |
* If this is true it returns TRUE. If the parameter \b index
|
- |
|
473 |
* points to an invalid index, FALSE is returned.
|
- |
|
474 |
*
|
- |
|
475 |
* @param index The index of the element to test.
|
- |
|
476 |
*
|
- |
|
477 |
* @return If the element is a valid element and has a START tag it
|
- |
|
478 |
* return TRUE. Otherwise FALSE is returned.
|
- |
|
479 |
*/
|
- |
|
480 |
bool isElementTypeStart(size_t index);
|
- |
|
481 |
/**
|
- |
|
482 |
* @brief bool isElementTypeEnd(size_t index)
|
- |
|
483 |
* Test the element the index is pointing to, for the type END. If
|
- |
|
484 |
* this is true it returns TRUE. If the parameter \b index points
|
- |
|
485 |
* to an invalid index, TRUE is returned.
|
- |
|
486 |
*
|
- |
|
487 |
* @param index The index of the element to test.
|
- |
|
488 |
*
|
- |
|
489 |
* @return If the element is a valid element and not an END tag it
|
- |
|
490 |
* return FALSE. Otherwise TRUE is returned.
|
- |
|
491 |
*/
|
- |
|
492 |
bool isElementTypeEnd(size_t index);
|
- |
|
493 |
/**
|
- |
|
494 |
* @brief bool isElementTypeAtomic(size_t index)
|
- |
|
495 |
* Test the element the index is pointing to, for the type ATOMIC.
|
- |
|
496 |
* If this is true it returns TRUE. If the parameter \b index
|
- |
|
497 |
* points to an invalid index, FALSE is returned.
|
- |
|
498 |
*
|
- |
|
499 |
* @param index The index of the element to test.
|
- |
|
500 |
*
|
- |
|
501 |
* @return If the element is a valid element and an ATOMIC tag it
|
- |
|
502 |
* return TRUE. Otherwise FALSE is returned.
|
- |
|
503 |
*/
|
- |
|
504 |
bool isElementTypeAtomic(size_t index);
|
- |
|
505 |
/**
|
- |
|
506 |
* @brief bool getElementType(size_t index);
|
- |
|
507 |
* Returns the internal type of the element the parameter
|
- |
|
508 |
* \b index is pointing to.
|
- |
|
509 |
*
|
- |
|
510 |
* @param index The index of the element.
|
- |
|
511 |
*
|
- |
|
512 |
* @return If \b index points to a valid element the type of it is
|
- |
|
513 |
* returned. If it is an invalid element it will return always
|
- |
|
514 |
* _ET_END.
|
- |
|
515 |
*/
|
- |
|
516 |
_ETYPE_t getElementType(size_t index);
|
- |
|
517 |
/**
|
- |
|
518 |
* @brief bool getElementTypeStr(size_t index)
|
- |
|
519 |
* Returns the internal type of the element the parameter
|
- |
|
520 |
* \b index is pointing to as a string.
|
- |
|
521 |
*
|
- |
|
522 |
* @param index The index of the element.
|
- |
|
523 |
*
|
- |
|
524 |
* @return If \b index points to a valid element the type of it is
|
- |
|
525 |
* returned. If it is an invalid element it will return always
|
- |
|
526 |
* "END".
|
- |
|
527 |
*/
|
- |
|
528 |
std::string getElementTypeStr(size_t index);
|
- |
|
529 |
/**
|
465 |
* Checks whether the internal pointer points to a valid entry or
|
530 |
* Checks whether the internal pointer points to a valid entry or
|
466 |
* not. If the internal pointer is valid it returns the name of the
|
531 |
* not. If the internal pointer is valid it returns the name of the
|
467 |
* entity the pointer points to.
|
532 |
* entity the pointer points to.
|
468 |
*
|
533 |
*
|
469 |
* @param valid This is an optional parameter. If this is set, then
|
534 |
* @param valid This is an optional parameter. If this is set, then
|