Example #1
0
int FuzzyStrCmp(const wxString& a, const wxString& b)
{
	size_t aCookie = 0, bCookie = 0;
	wxString aField, bField;

	do {
		aField = GetNextField(a, aCookie);
		bField = GetNextField(b, bCookie);

		if (aField.IsNumber() && bField.IsNumber()) {
			unsigned long aInteger = StrToULong(aField);
			unsigned long bInteger = StrToULong(bField);
			
			if (aInteger < bInteger) {
				return -1;
			} else if (aInteger > bInteger) {
				return  1;
			}
		} else if (aField < bField) {
			return -1;
		} else if (aField > bField) {
			return  1;
		}
	} while (!aField.IsEmpty() && !bField.IsEmpty());

	return 0;
}
Example #2
0
/**
 * @function ListRefresh
 * @brief list task
 * @param void *_g_obj: generic object
 * @param void *_obj: list object
 * @return none
 */
static void ListRefresh(void *_g_obj, void *_obj) {

  g_obj_st *g_obj;
  list_st *list;
  coord_t yt, y;
  uint16_t itemPos;
  field_st *field;

  /*retreive generic & specific object*/
  if(_g_obj != NULL && _obj != NULL) {
    g_obj = (g_obj_st *) _g_obj;
    list =  (list_st*) _obj;

    /*if the list need a refresh before ListRefresh() exec, it means that
      an external event leaded to this refresh(e.g. scroll) -> we need to
      maually refresh the header of the list */
    if(GUI_ObjIsNeedRefresh(g_obj) && list->g_obj_header != NULL) {
      GUI_ObjSetNeedRefresh(list->g_obj_header, true);
    }

    /*handle touchscreen interaction*/
    if(GUI_ObjIsPressed(g_obj) && GUI_ObjIsDisabled(g_obj) == false) {
      GUI_ReadTouchScreen(NULL, &yt);

      /*retrieve the first item visible (according to the scroller pos)*/
      itemPos = 0;
      field = GetFirstField(list);
      while(field != NULL && itemPos < list->vScroll.offset) {
        field = GetNextField(field, list->bReversedSort);
        itemPos++;
      }

      /*find the item corresponding to the touchscreen y*/
      y = g_obj->rec.y;
      while(field != NULL && y + list->hItem < yt) {
        field = GetNextField(field, list->bReversedSort);
        y += list->hItem;
      }

      /*item selected != of the previous one? refresh list*/
      if(field != NULL) {
        if(list->pSelectedItem != field->pItem) {
          list->pSelectedItem = field->pItem;
          GUI_ObjSetNeedRefresh(g_obj, true);
        }
      }
      else {
        if(list->pSelectedItem != NULL) {
          list->pSelectedItem = NULL;
          GUI_ObjSetNeedRefresh(g_obj, true);
        }
      }
    }
  }
}
Example #3
0
/**
 * @function ListDraw
 * @brief list draw function
 * @param void *_g_obj: generic object
 * @param void *_obj: list object
 * @return none
 */
static void ListDraw(void *_g_obj, void *_obj) {

  g_obj_st *g_obj;
  list_st *list;
  field_st *field;
  uint16_t itemPos;
  rect_st lrec;
  coord_t x, yEnd;

  /*retreive generic & specific object*/
  if(_g_obj != NULL && _obj != NULL) {
    g_obj = (g_obj_st *) _g_obj;
    list =  (list_st*) _obj;

    /*P2D configuration*/
    P2D_SetDisplayMode(DISPLAY_SOLID);
    P2D_SetLineType(LINE_SOLID);
    SetFont(list->font);

    /*find the first field to display, according to vertical offset, selected category and sort (normal/reverse) */
    itemPos = 0;
    field = GetFirstField(list);
    while(field != NULL && itemPos < list->vScroll.offset) {
      field = GetNextField(field, list->bReversedSort);
      itemPos++;
    }

    /*display items*/
    lrec = g_obj->rec;
    lrec.h = list->hItem;
    yEnd = g_obj->rec.y + g_obj->rec.h;
    x = g_obj->rec.x - list->hScroll.offset;

    while(field != NULL && lrec.y < yEnd) {

      DrawItem(list, &lrec, field->pItem, itemPos, x);

      lrec.y += lrec.h;
      itemPos++;
      field = GetNextField(field, list->bReversedSort);
    }

    /*...if there is not enought item to fill the object dimension*/
    if(lrec.y < yEnd) {
      lrec.h = g_obj->rec.h;
      P2D_SetColor(GetColor(G_COL_E_BACKGROUND));
      P2D_FillRect(&lrec);
    }
  }
}
Example #4
0
	bool ReadCSV::ReadRecord()
	{
		m_vValues.clear();

		bool bEOL = false;
		TsString strVal;
		while(GetNextField(strVal))
			m_vValues.push_back(strVal);

		return m_vValues.size()!=0;
	}
Example #5
0
/**
 * @function GUI_W_ListDeleteContent
 * @brief delete all items of a given list. ITEMS SHALL BE THE LAST ALLOCATED ELEMENTS !!
 * @param g_obj_st *obj: pointer to list
 * @return none
 */
void GUI_W_ListDeleteContent(g_obj_st /*@null@*/ *obj) {

  list_st *list = NULL;
  field_st *field = NULL;
  void *addr = NULL;
  category_st *category = NULL;

  /*retrieve the list corresponding to the generic object*/
  list = GetList(obj);
  if(list != NULL) {

    /*find the item #0*/
    field = GetFirstField(list);
    while(field != NULL && addr == NULL) {
      if(field->pItem->uid == 0) addr = (void *)field->pItem;
      else field = GetNextField(field, list->bReversedSort);
    }

    if(addr != NULL) {

      /*item found? clear all memory from its addr*/
      sfreeFrom(addr);

      /*reset list*/
      category = list->pCategory;
      while(category != NULL) {
        category->head = category->tail = NULL;
        category = category->next;
      }
      list->pLastItem = NULL;
      list->pSelectedItem = NULL;
      list->wSpriteMax = 0;
      list->vScroll.totSize = 0;

      /*need to refresh (for clearing window content)*/
      GUI_ObjSetNeedRefresh(obj, true);
    }
  }
}
// ---------------------------------------------------------
// CMailToHandler::FieldEnd()
// ---------------------------------------------------------
//
TInt CMailToHandler::FieldEnd(const TDesC& aHeader)
	{
	CLOG_ENTERFN( "CMailToHandler::FieldEnd()" );

	TPtrC path = iParsedUrl->Des();
	TInt length = path.Length(); // length of the scheme
    TInt retVal = length;

    TInt startPos = FieldStart( aHeader );

	if( IsHeader( aHeader ) )
		{
        TInt temp = GetNextField( startPos );
        /* we need to subtract 1 if the result is 
           not equal to length because of the & or ? */
        retVal = ( temp == length ) ? length : ( temp - 1);
		}

	CLOG_LEAVEFN( "CMailToHandler::FieldEnd()" );

	return retVal;
	}
Example #7
0
char FortranFormat::GetNextCharacter()
   {
   GetNextField(buffer);

   return buffer[0];
   }
Example #8
0
int FortranFormat::GetNextInteger()
   {
   GetNextField(buffer);

   return buffer.AsInteger();
   }