cr-string.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
  2. /*
  3. * This file is part of The Croco Library
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of version 2.1 of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  17. * USA
  18. *
  19. * See COPYRIGHTS file for copyright information.
  20. */
  21. /**
  22. *@file
  23. *Declaration file of the #CRString class.
  24. */
  25. #ifndef __CR_STRING_H__
  26. #define __CR_STRING_H__
  27. #include <glib.h>
  28. #include "cr-utils.h"
  29. #include "cr-parsing-location.h"
  30. G_BEGIN_DECLS
  31. typedef struct _CRString CRString ;
  32. /**
  33. *This is a ship implementation of string based on GString.
  34. *Actually, the aim of CRString is to store the parsing location
  35. *(line,column,byte offset) at which a given string has been parsed
  36. *in the input CSS.
  37. *So this class has a gstring field of type GString that users can
  38. *freely manipulate, and also a CRParginLocation type where the
  39. *parsing location is store. If you don't want to deal with parsing
  40. *location stuffs, then use GString instead. If we were in C++ for example,
  41. *CRString would just inherit GString and just add accessors to
  42. *the CRParsingLocation data ... but we are not and we still have
  43. *to provide the parsing location information.
  44. */
  45. struct _CRString {
  46. /**
  47. *The GString where all the string
  48. *operation happen.
  49. */
  50. GString *stryng ;
  51. /**
  52. *The parsing location storage area.
  53. */
  54. CRParsingLocation location ;
  55. } ;
  56. CRString * cr_string_new (void) ;
  57. CRString *cr_string_new_from_string (const gchar * a_string) ;
  58. CRString * cr_string_new_from_gstring (GString const *a_string) ;
  59. CRString *cr_string_dup (CRString const *a_this) ;
  60. gchar *cr_string_dup2 (CRString const *a_this) ;
  61. const gchar *cr_string_peek_raw_str (CRString const *a_this) ;
  62. gint cr_string_peek_raw_str_len (CRString const *a_this) ;
  63. void cr_string_destroy (CRString *a_this) ;
  64. G_END_DECLS
  65. #endif