Example #1
0
/*#
   @method getSections ConfParser
   @brief Enumerates the sections that are declared in the file managed by this object.
   @return All the values of associated to the key, or nil if not found.

   If the object doesn't declare any section, the method returns an empty array.
*/
FALCON_FUNC  ConfParser_getSections( ::Falcon::VMachine *vm )
{
   CoreObject *self = vm->self().asObject();
   ConfigFile *cfile = (ConfigFile *) self->getUserData();

   String section;
   CoreArray *ret = new CoreArray;

   if( cfile->getFirstSection( section ) )
   {
      ret->append( new CoreString( section ) );
      while( cfile->getNextSection( section ) )
         ret->append( new CoreString( section ) );
   }

   vm->retval( ret );
}