Commit 922a5119c8dc07d453ba0db18033af9784c9604a

Authored by Jürgen Knödlseder
1 parent 59913421

Document GUrl classes

doc/source/user_manual/modules/support.rst
... ... @@ -278,3 +278,35 @@ Function Description
278 278  
279 279 Media independent information handling
280 280 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  281 +
  282 +To handle media independent data access, the ``GUrl`` base class has been
  283 +implemented that represent a media in an abstract way. The class has
  284 +abstract ``open``, ``read``, ``write`` and ``close`` method to open
  285 +a media, read from it or write to it, and to close the media.
  286 +
  287 +Support is implemented so far for file and string media, but in the futur,
  288 +direct access to ressources over the internet may become possible.
  289 +A file media is implemented by the ``GUrlFile`` class, while a string
  290 +media is implemented by the ``GUrlString`` class.
  291 +
  292 +An example of a class making using of ``GUrl`` is the ``GXml`` class. Look
  293 +at the following code:
  294 +
  295 +.. code-block:: cpp
  296 + :linenos:
  297 +
  298 + GXml xml;
  299 + xml.append(GXmlElement("dummy"));
  300 + GUrlFile file("my_file.xml", "w");
  301 + GUrlString chain;
  302 + xml.write(file);
  303 + xml.write(chain);
  304 +
  305 +Line 1 declares a XML object and in line 2 we append a dummy element
  306 +to it. In line 3 we now create a file named ``my_file.xml`` for which
  307 +we allow write access. In line 4 we allocate a string media. We then
  308 +write the XML object first into the file in line 5, and the in the string
  309 +in line 6. This illustrates how the ``GUrl`` classes can be used to
  310 +redirect the same information to different media. Reading from different
  311 +media is analoguous.
  312 +
... ...