void FieldsSet::set(int32_t field, int32_t amount) {
    if (field<0|| field>=fieldCount()) {
        return;
    }
    fValue[field] = amount;
    fIsSet[field] = TRUE;
}
void FieldsSet::clear(int32_t field) {
    if (field<0|| field>=fieldCount()) {
        return;
    }
    fValue[field] = -1;
    fIsSet[field] = FALSE;
}
示例#3
0
void JsonWriter::begin(Type t)
{
	if (!stack_.empty()) {
		if (fieldCount() > 0) {
			output_ << ",\n";
		}
		else if (isArray() && fieldCount() == 0) {
			output_ << "\n";
		}

		indent();

		incrementFieldCount();
	}

	push(t);
}
int KisColorPatches::widthForHeight(int height) const
{
    if( height == 0 ) {
        return 0;
    }
    int numPatchesInACol = height/m_patchHeight;
    int numCols = (fieldCount()-1)/numPatchesInACol+1;
    return numCols*m_patchWidth;
}
QgsAttributeList QgsVectorDataProvider::attributeIndexes()
{
  uint count = fieldCount();
  QgsAttributeList list;

  for ( uint i = 0; i < count; i++ )
    list.append( i );

  return list;
}
示例#6
0
void JsonWriter::preValue()
{
	if (isComplex()) {
		if (fieldCount() > 0) { // i.e. Array
			output_ << ",\n";
		} else {
			output_ << "\n";
		}
		indent();
	}
	incrementFieldCount();
}
示例#7
0
void KisColorPatches::paintEvent(QPaintEvent* e)
{
    QPainter painter(this);
    if(m_allowScrolling) {
        if(m_direction == Vertical)
            painter.translate(0, m_scrollValue);
        else
            painter.translate(m_scrollValue, 0);
    }


    int widgetWidth = width();
    int numPatchesInARow = widgetWidth/m_patchWidth;

    int widgetHeight = height();
    int numPatchesInACol = widgetHeight/m_patchHeight;

    for(int i=m_buttonList.size(); i<qMin(fieldCount(), m_colors.size()+m_buttonList.size()); i++) {
        int row;
        int col;
        if(m_direction==Vertical) {
            row= i/numPatchesInARow;
            col = i%numPatchesInARow;
        }
        else {
            row= i%numPatchesInACol;
            col = i/numPatchesInACol;
        }

        QColor qcolor = converter()->toQColor(m_colors.at(i-m_buttonList.size()));

        painter.fillRect(col*m_patchWidth,
                         row*m_patchHeight,
                         m_patchWidth,
                         m_patchHeight,
                         qcolor);
    }

    QWidget::paintEvent(e);
}
UnicodeString FieldsSet::diffFrom(const FieldsSet& other, UErrorCode& status) const {
    UnicodeString str;
    if(!isSameType(other)) {
        status = U_ILLEGAL_ARGUMENT_ERROR;
        return UnicodeString("U_ILLEGAL_ARGUMENT_ERROR: FieldsSet of a different type!");
    }
    for (int i=0; i<fieldCount(); i++) {
        if (isSet((UCalendarDateFields)i)) {
            int32_t myVal = get(i);
            int32_t theirVal = other.get(i);

            if(fEnum != -1) {
                const UnicodeString& fieldName = udbg_enumString(
                                                     fEnum, i);

                str = str + fieldName + UnicodeString("=")+myVal+UnicodeString(" not ")+theirVal+UnicodeString(", ");
            } else {
                str = str + UnicodeString("some field") + "=" + myVal+" not " + theirVal+", ";
            }
        }
    }
    return str;
}
int KisColorPatches::heightForWidth(int width) const
{
    int numPatchesInARow = width/m_patchWidth;
    int numRows = (fieldCount()-1)/numPatchesInARow+1;
    return numRows*m_patchHeight;
}
int KisColorPatches::heightOfAllPatches()
{
    return (fieldCount()/m_numCols)*m_patchHeight;
}
int KisColorPatches::widthOfAllPatches()
{
    return (fieldCount()/m_numRows)*m_patchWidth;
}
int32_t FieldsSet::get(int32_t field) const {
    if (field<0|| field>=fieldCount()) {
        return -1;
    }
    return fValue[field];
}
UBool FieldsSet::isSet(int32_t field) const {
    if (field<0|| field>=fieldCount()) {
        return FALSE;
    }
    return fIsSet[field];
}
void FieldsSet::clear() {
    for (int i=0; i<fieldCount(); i++) {
        fValue[i]=-1;
        fIsSet[i]=FALSE;
    }
}
// Derived class required function to make a copy.
IContainerObject* TableObject::objectCopy()
{
   TableObject* pObject = new(fieldCount()) TableObject(*this);
   return (IContainerObject*)pObject;
}