utility_io.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*****************************************************************************
  2. * Erwin Aertbelien, Div. PMA, Dep. of Mech. Eng., K.U.Leuven
  3. *
  4. * \version
  5. * ORO_Geometry V0.2
  6. *
  7. * \par History
  8. * - $log$
  9. *
  10. * \par Release
  11. * $Name: $
  12. *
  13. * \file utility_io.h
  14. * Included by most lrl-files to provide some general
  15. * functions and macro definitions related to file/stream I/O.
  16. */
  17. #ifndef KDL_UTILITY_IO_H_84822
  18. #define KDL_UTILITY_IO_H_84822
  19. //#include <kdl/kdl-config.h>
  20. // Standard includes
  21. #include <iostream>
  22. #include <iomanip>
  23. #include <fstream>
  24. namespace KDL {
  25. /**
  26. * checks validity of basic io of is
  27. */
  28. void _check_istream(std::istream& is);
  29. /**
  30. * Eats characters of the stream until the character delim is encountered
  31. * @param is a stream
  32. * @param delim eat until this character is encountered
  33. */
  34. void Eat(std::istream& is, int delim );
  35. /**
  36. * Eats characters of the stream as long as they satisfy the description in descript
  37. * @param is a stream
  38. * @param descript description string. A sequence of spaces, tabs,
  39. * new-lines and comments is regarded as 1 space in the description string.
  40. */
  41. void Eat(std::istream& is,const char* descript);
  42. /**
  43. * Eats a word of the stream delimited by the letters in delim or space(tabs...)
  44. * @param is a stream
  45. * @param delim a string containing the delimmiting characters
  46. * @param storage for returning the word
  47. * @param maxsize a word can be maximally maxsize-1 long.
  48. */
  49. void EatWord(std::istream& is,const char* delim,char* storage,int maxsize);
  50. /**
  51. * Eats characters of the stream until the character delim is encountered
  52. * similar to Eat(is,delim) but spaces at the end are not read.
  53. * @param is a stream
  54. * @param delim eat until this character is encountered
  55. */
  56. void EatEnd( std::istream& is, int delim );
  57. }
  58. #endif