Ejemplo n.º 1
0
void check(Memory * memory, char * inputString)
{
	int ex = ifExist(inputString, memory);
	// printf("%s\n", inputString);
	if(ex != notExist)
	{
		printf("%s\n", "Yes, it matched!");
		memory->item[ex].times += 1;
		// memory->item[memory->matchIndex].times += 1;
	}
	else
	{
		printf("%s\n", "No, not matched!");
		strcpy(memory->item[memory->index].content, inputString);
		memory->item[memory->index].times = 1;
		memory->index += 1;
		
		// printf("index = %d\n", memory->index);
		// printf("memory->item[memory->index].times = %d\n", memory->item[memory->index].times);
		// printf("%s%d\n","memory->index = ", memory->index);
		// printf("%s%s\n","memory->item[memory->index].content = ", memory->item[memory->index].content);
	}
}
Ejemplo n.º 2
0
      /* Method to get the description of a given value
       *
       * @param variable   Variable name.
       * @param section    Section the variable belongs to.
       *
       */
   string ConfDataReader::getValueDescription( string variable,
                                               string section )
      throw(ConfigurationException)
   {

         // Let's make sure that section and variable names are uppercase
      section  = StringUtils::upperCase(section);
      variable = StringUtils::upperCase(variable);

      try
      {

            // Auxiliar variable to store current 'issueException' state
         bool exceptionState( getIssueException() );

            // If 'fallback2Default' is set, and this is NOT the 'DEFAULT'
            // section, we need to temporarily disable 'issueException'.
            // This implies that there is no fallback for 'DEFAULT' variables
         if( (section != "DEFAULT") && (section != "") )
         {
            if( getFallback2Default() )
            {
               setIssueException(false);
            }
         }


            // Check if section and variable exist
         if( ifExist(variable, section) )
         {

               // Reset 'issueException' to its correct value before continue
            setIssueException( exceptionState );

            return confData[section][variable].valueComment;

         }
         else
         {

               // Reset 'issueException' to its correct value before continue
            setIssueException( exceptionState );

               // If 'fallback2Default' is set, check also in 'DEFAULT' section
            if ( getFallback2Default() )
            {

               if( ifExist(variable) )
               {

                  return confData["DEFAULT"][variable].valueComment;

               }
               else
               {

                  return "";

               }

            }
            else
            {

               return "";

            }  // End of 'if ( getFallback2Default() )'

         }  // End of 'if( ifExist(variable, section) )'

      }
      catch (ConfigurationException& e)
      {
         GPSTK_RETHROW(e);
      }

   }  // End of method 'ConfDataReader::getValueDescription()'