Пример #1
0
void StandardField::createLongAlarm() {
    size_t numFields = 10;
    FieldConstPtrArray fields(numFields);
    StringArray names(numFields);
    names[0] = "active";
    names[1] = "lowAlarmLimit";
    names[2] = "lowWarningLimit";
    names[3] = "highWarningLimit";
    names[4] = "highAlarmLimit";
    names[5] = "lowAlarmSeverity";
    names[6] = "lowWarningSeverity";
    names[7] = "highWarningSeverity";
    names[8] = "highAlarmSeverity";
    names[9] =  "hystersis";
    fields[0] = fieldCreate->createScalar(pvBoolean);
    fields[1] = fieldCreate->createScalar(pvLong);
    fields[2] = fieldCreate->createScalar(pvLong);
    fields[3] = fieldCreate->createScalar(pvLong);
    fields[4] = fieldCreate->createScalar(pvLong);
    fields[5] = fieldCreate->createScalar(pvInt);
    fields[6] = fieldCreate->createScalar(pvInt);
    fields[7] = fieldCreate->createScalar(pvInt);
    fields[8] = fieldCreate->createScalar(pvInt);
    fields[9] = fieldCreate->createScalar(pvLong);
    longAlarmField = fieldCreate->createStructure("valueAlarm_t",names,fields);
}
SUPPRESS_OFFSET_WARNING_BEGIN

int ThickeningParameters::staticInit()
{

    ReflectionNaming &nameing = naming();
    nameing = ReflectionNaming(
        "Thickening Parameters",
        "Thickening Parameters",
        ""
    );
     

    fields().push_back(
        new IntField
        (
          ThickeningParameters::POWER_ID,
          offsetof(ThickeningParameters, mPower),
          5000,
          "Power",
          "Power",
          "Power"
        )
    );
   return 0;
}
Пример #3
0
static bool getYesterdayTodayAndTomorrow(JNIEnv* env, jobject localeData, const char* locale_name) {
  UErrorCode status = U_ZERO_ERROR;
  ScopedResourceBundle root(ures_open(NULL, locale_name, &status));
  if (U_FAILURE(status)) {
    return false;
  }
  ScopedResourceBundle calendar(ures_getByKey(root.get(), "calendar", NULL, &status));
  if (U_FAILURE(status)) {
    return false;
  }
  ScopedResourceBundle gregorian(ures_getByKey(calendar.get(), "gregorian", NULL, &status));
  if (U_FAILURE(status)) {
    return false;
  }
  ScopedResourceBundle fields(ures_getByKey(gregorian.get(), "fields", NULL, &status));
  if (U_FAILURE(status)) {
    return false;
  }
  ScopedResourceBundle day(ures_getByKey(fields.get(), "day", NULL, &status));
  if (U_FAILURE(status)) {
    return false;
  }
  ScopedResourceBundle relative(ures_getByKey(day.get(), "relative", NULL, &status));
  if (U_FAILURE(status)) {
    return false;
  }
  // bn_BD only has a "-2" entry.
  if (relative.hasKey("-1") && relative.hasKey("0") && relative.hasKey("1")) {
    setStringField(env, localeData, "yesterday", relative.get(), "-1");
    setStringField(env, localeData, "today", relative.get(), "0");
    setStringField(env, localeData, "tomorrow", relative.get(), "1");
    return true;
  }
  return false;
}
Пример #4
0
bool SlimServerInfo::ProcessServerInfo(QByteArray response)
{
    DEBUGF("");
    QList<QByteArray> aList = response.split( ' ' );  // split response into various pairs

    QListIterator<QByteArray> fields(aList);
    while(fields.hasNext()){
        QString line = QString(fields.next());
        if(line.section("%3A",0,0)=="lastscan")
            lastServerRefresh = line.section("%3A",1,1).toAscii().toInt();
        else if(line.section("%3A",0,0)=="version")
            serverVersion=line.section("%3A",1,1).toAscii();
        else if(line.section("%3A",0,0)=="info%20total%20albums")
            totalAlbums=line.section("%3A",1,1).toAscii().toInt();
        else if(line.section("%3A",0,0)=="info%20total%20artists")
            totalArtists=line.section("%3A",1,1).toAscii().toInt();
        else if(line.section("%3A",0,0)=="info%20total%20genres")
            totalGenres=line.section("%3A",1,1).toAscii().toInt();
        else if(line.section("%3A",0,0)=="info%20total%20songs")
            totalSongs=line.section("%3A",1,1).toAscii().toInt();
        else if(line.section("%3A",0,0)=="player%20count")
            playerCount=line.section("%3A",1,1).toAscii().toInt();
    }
    return true;

}
Пример #5
0
boost::optional<Document> DocumentSourceRedact::redactObject(const Variables& in) {
    const Value expressionResult = _expression->evaluate(in);

    if (expressionResult == keepVal) {
        return in.current.getDocument();
    }
    else if (expressionResult == pruneVal) {
        return boost::optional<Document>();
    }
    else if (expressionResult == descendVal) {
        MutableDocument out;
        FieldIterator fields(in.current.getDocument());
        while (fields.more()) {
            const Document::FieldPair field(fields.next());
            const Value val = redactValue(in, field.second);
            if (!val.missing()) {
                out.addField(field.first, val);
            }
        }
        return out.freeze();
    }
    else {
        uasserted(17053, str::stream() << "$redact's expression should not return anything "
                  << "aside from the variables $$KEEP, $$DESCEND, and "
                  << "$$PRUNE, but returned "
                  << expressionResult.toString());
    }
}
SUPPRESS_OFFSET_WARNING_BEGIN

int InputFilterParameters::staticInit()
{

    ReflectionNaming &nameing = naming();
    nameing = ReflectionNaming(
        "Input Filter Parameters",
        "Input Filter Parameters",
        ""
    );
     

    fields().push_back(
        new EnumField
        (
          InputFilterParameters::INPUT_TYPE_ID,
          offsetof(InputFilterParameters, mInputType),
          0,
          "Input Type",
          "Input Type",
          "Input Type",
           NULL
        )
    );
   return 0;
}
QgsFieldConstraints::Constraints QgsVectorDataProvider::fieldConstraints( int fieldIndex ) const
{
  QgsFields f = fields();
  if ( fieldIndex < 0 || fieldIndex >= f.count() )
    return nullptr;

  return f.at( fieldIndex ).constraints().constraints();
}
Пример #8
0
string Table::toString()
{
	string s;

	for (int index = 0; index < fields()->count(); index++)
	{
		if (Field* f = fields()->getByIndex(index))
		{
			s += intToStr(index + 1) + ". " + f->getDefinition();

			if (index < (fields()->count() - 1))
				s +="\r\n";
		}
	}

	return s;
}
Пример #9
0
std::string Parser::arg1() const {
	assert(fields(current_line_) >= 1);
// Expected behaviour according to the spec.
	if (this->commandType() == C_ARITHMETIC)
		return field(current_line_, 0);
	else
		return field(current_line_, 1);
}
Пример #10
0
Файл: pvs.c Проект: jff/mathspad
static void handle_pvs_mod(unsigned char *buffer)
{
  /* buffer contains "dir&file&place&filename" */
  if (fields(buffer)==4) {
    fprintf(stderr, PVSMESSAGE "Modifing commands not supported\n"
	    PVSMESSAGE "%s&%s&%s&%s\n", field[0],field[1],field[2],field[3]);
  }
}
Пример #11
0
Файл: pvs.c Проект: jff/mathspad
static void handle_pvs_dis(unsigned char *buffer)
{
  /* buffer contains "proof&instance&type&value" */
  if (fields(buffer)==4) {
    fprintf(stderr, PVSMESSAGE "Display commands not supported\n"
	    PVSMESSAGE "%s&%s&%s&%s\n", field[0],field[1],field[2],field[3]);
  }
}
	/**
	 * Load and initialize cluster definition and GeoIP data if any
	 *
	 * @param myAddress My ZeroTier address
	 * @param pathToClusterFile Path to cluster definition file
	 * @throws std::runtime_error Invalid cluster definition or unable to load data
	 */
	ClusterDefinition(uint64_t myAddress,const char *pathToClusterFile)
	{
		std::string cf;
		if (!OSUtils::readFile(pathToClusterFile,cf))
			return;

		char myAddressStr[64];
		Utils::snprintf(myAddressStr,sizeof(myAddressStr),"%.10llx",myAddress);

		std::vector<std::string> lines(OSUtils::split(cf.c_str(),"\r\n","",""));
		for(std::vector<std::string>::iterator l(lines.begin());l!=lines.end();++l) {
			std::vector<std::string> fields(OSUtils::split(l->c_str()," \t","",""));
			if ((fields.size() < 5)||(fields[0][0] == '#')||(fields[0] != myAddressStr))
				continue;

			// <address> geo <CSV path> <ip start column> <ip end column> <latitutde column> <longitude column>
			if (fields[1] == "geo") {
				if ((fields.size() >= 7)&&(OSUtils::fileExists(fields[2].c_str()))) {
					int ipStartColumn = Utils::strToInt(fields[3].c_str());
					int ipEndColumn = Utils::strToInt(fields[4].c_str());
					int latitudeColumn = Utils::strToInt(fields[5].c_str());
					int longitudeColumn = Utils::strToInt(fields[6].c_str());
					if (_geo.load(fields[2].c_str(),ipStartColumn,ipEndColumn,latitudeColumn,longitudeColumn) <= 0)
						throw std::runtime_error(std::string("failed to load geo-ip data from ")+fields[2]);
				}
				continue;
			}

			// <address> <ID> <name> <backplane IP/port(s)> <ZT frontplane IP/port(s)> <x,y,z>
			int id = Utils::strToUInt(fields[1].c_str());
			if ((id < 0)||(id > ZT_CLUSTER_MAX_MEMBERS))
				throw std::runtime_error(std::string("invalid cluster member ID: ")+fields[1]);
			MemberDefinition &md = _md[id];

			md.id = (unsigned int)id;
			if (fields.size() >= 6) {
				std::vector<std::string> xyz(OSUtils::split(fields[5].c_str(),",","",""));
				md.x = (xyz.size() > 0) ? Utils::strToInt(xyz[0].c_str()) : 0;
				md.y = (xyz.size() > 1) ? Utils::strToInt(xyz[1].c_str()) : 0;
				md.z = (xyz.size() > 2) ? Utils::strToInt(xyz[2].c_str()) : 0;
			}
			Utils::scopy(md.name,sizeof(md.name),fields[2].c_str());
			md.clusterEndpoint.fromString(fields[3]);
			if (!md.clusterEndpoint)
				continue;
			std::vector<std::string> zips(OSUtils::split(fields[4].c_str(),",","",""));
			for(std::vector<std::string>::iterator zip(zips.begin());zip!=zips.end();++zip) {
				InetAddress i;
				i.fromString(*zip);
				if (i)
					md.zeroTierEndpoints.push_back(i);
			}

			_ids.push_back((unsigned int)id);
		}

		std::sort(_ids.begin(),_ids.end());
	}
TEST_F( FieldsTest, FieldsMethodInAssignment ) {
  Fields abc = fields
               ( "a", ActiveRecord::integer )
               ( "b", ActiveRecord::text )
               ( "c", ActiveRecord::floating_point )
               ( "d", ActiveRecord::date );

  ASSERT_EQ( 4, abc.size() );
}
Пример #14
0
	void VolumePropertiesDialog::AppendToList (const string &name, const wxString &value)
	{
		vector <wstring> fields (PropertiesListCtrl->GetColumnCount());

		fields[0] = LangString[name];
		fields[1] = value;

		Gui->AppendToListCtrl (PropertiesListCtrl, fields);
	}
Пример #15
0
void __fastcall TfrmRetrieveMain::AddClick( TObject *Sender ) {
	if( !OpenDialog1->Execute( ) ) {
		return;
	}
	Screen->Cursor = crSQLWait;
	progress->Position = 0;
	std::unique_ptr < TStrings > lines( new TStringList );
	lines->LoadFromFile( OpenDialog1->FileName );
	progress->Max = lines->Count;
	std::unique_ptr < TStrings > fields( new TStringList );
	bool expectPos = (rgDestOrder->ItemIndex == FROM_FILE);
	bool finished = false;
	for( int line = 0; line < lines->Count; ) {
		fields->CommaText = lines->Strings[ line ++ ];
		int pos;
		String warning;
		switch( fields->Count ) {
			case 0:
				continue;
			case 1:
				if( expectPos ) {
					warning = "No position";
				} else {
					pos = rows.size() + 1;
				}
				break;
			case 2:
				if( expectPos ) {
					pos = fields->Strings[ 1 ].ToIntDef( -1 );
					if( pos < 1 ) {
						warning = "Invalid position";
					}
					break;
				}
			default:
				warning = "Extra characters";
		}

		if( warning.IsEmpty() ) {
			warning = addCryovials( fields->Strings[ 0 ], pos );
		}
		if( !warning.IsEmpty() ) {
			warning = warning + " on line " + String( line );
			if( Application->MessageBox( warning.c_str(), L"Warning", MB_OKCANCEL | MB_ICONWARNING) != IDOK ) {
				rows.clear( );
				break;
			}
		}
		progress->StepIt( );
		fillGrid( );
		Application->ProcessMessages( );
	}
	Screen->Cursor = crDefault;
	sortList.clear( );
	updateDisplay();
}
Пример #16
0
int
header_table_tests (void)
{
    int re;

    re  = blocks();
    re += fields();

    return re;
}
Пример #17
0
static void fields(FIELD *start,int group)
{
    FIELD *walk;
    TAG *scan;
    VALUE_LIST *tag;

    for (walk = start; walk; walk = walk->next) {
        if (walk->structure) {
            fields(walk->my_block,group);
            continue;
        }
        if (*walk->id != '_') {
            if (walk->value && walk->value->type == vt_case)
                to_c("    { %d, %d, %d, values_%d, %d }, /* %s */\n",group,
                     walk->pos,walk->size,walk->field,walk->var_len,walk->id);
            else to_c("    { %d, %d, %d, NULL, %d }, /* %s */\n",group,
                          walk->pos,walk->size,walk->var_len,walk->id);
        }
        if (walk->value)
            switch  (walk->value->type) {
            case vt_id:
                break;
            case vt_case:
            case vt_multi:
                for (scan = walk->value->tags; scan; scan = scan->next)
                    fields(scan->block,scan->group);
                to_test("static int unique_%d[] = { /* %s */\n",unique++,
                        walk->id);
                for (scan = walk->value->tags; scan; scan = scan->next) {
                    to_test("    %s,\n",scan->value);
                    for (tag = scan->more; tag; tag = tag->next)
                        to_test("    %s,\n",tag->value);
                }
                to_test("    -1\n};\n\n");
                break;
            case vt_length:
                fields(walk->value->block,group);
                break;
            default:
                abort();
            }
    }
}
Пример #18
0
PVStructurePtr PVDataCreate::createPVStructure(
        StringArray const & fieldNames,PVFieldPtrArray const & pvFields)
{
     size_t num = fieldNames.size();
     FieldConstPtrArray fields(num);
     for (size_t i=0;i<num;i++) fields[i] = pvFields[i]->getField();
     StructureConstPtr structure = fieldCreate->createStructure(fieldNames,fields);
     PVStructurePtr pvStructure(new PVStructure(structure,pvFields));
     return pvStructure;
}
Пример #19
0
IdfExtensibleGroup IdfExtensibleGroup::pushClone() const {
  if (empty()) {
    detail::IdfObject_ImplPtr p;
    return IdfExtensibleGroup(p,0);
  }

  StringVector values = fields();
  OS_ASSERT(values.size() == numFields());
  return m_impl->pushExtensibleGroup(values);
}
Пример #20
0
IdfExtensibleGroup IdfExtensibleGroup::insertClone(unsigned groupIndex) const {
  if (empty()) {
    detail::IdfObject_ImplPtr p;
    return IdfExtensibleGroup(p,0);
  }

  StringVector values = fields();
  OS_ASSERT(values.size() == numFields());
  return m_impl->insertExtensibleGroup(groupIndex,values);
}
Пример #21
0
void VarManager::search()
{
	setEnabled(false);

	QMultiMap<int, QString> vars = fieldArchive->searchAllVars();

	quint32 key;
	qint32 param;
	QTreeWidgetItem *item;
	QMap<int, bool> count;
	int lastVar=-1;

	QMapIterator<int, QString> i(vars);
	while(i.hasNext()) {
		i.next();
		if(lastVar == i.key())	continue;

		lastVar = i.key();
		JsmOpcode op(lastVar);
		key = op.key();
		param = op.param();
		count.insert(param, true);

		item = list->topLevelItem(param);
		item->setBackground(0, QColor(0xff,0xe5,0x99));

		if(key == 10 || key == 11 || key == 16) {
			item->setText(1, QString("%1Byte").arg(key == 16 ? "Signed " : ""));
		}
		else if(key == 12 || key == 13 || key == 17) {
			item->setText(1, QString("%1Word").arg(key == 17 ? "Signed " : ""));
			count.insert(param+1, true);
			list->topLevelItem(param+1)->setBackground(0, QColor(0xff,0xe5,0x99));
		}
		else if(key == 14 || key == 15 || key == 18) {
			item->setText(1, QString("%1Long").arg(key == 18 ? "Signed " : ""));
			count.insert(param+1, true);
			list->topLevelItem(param+1)->setBackground(0, QColor(0xff,0xe5,0x99));
			count.insert(param+2, true);
			list->topLevelItem(param+2)->setBackground(0, QColor(0xff,0xe5,0x99));
			count.insert(param+3, true);
			list->topLevelItem(param+3)->setBackground(0, QColor(0xff,0xe5,0x99));
		}
		QStringList fields(vars.values(lastVar));
		fields.append(item->text(3).split(", ", QString::SkipEmptyParts));
		fields.removeDuplicates();
		item->setText(3, fields.join(", "));
	}

	list->resizeColumnToContents(0);
	list->resizeColumnToContents(1);

	setEnabled(true);
	countLabel->setText(tr("Vars utilisés : %1/1536").arg(count.size()));
}
Пример #22
0
bool LinkLayerTest::OnFrame(LinkFunction func,
                            bool isMaster,
                            bool fcb,
                            bool fcvdfc,
                            uint16_t dest,
                            uint16_t source,
                            const openpal::RSlice& userdata)
{
    LinkHeaderFields fields(func, isMaster, fcb, fcvdfc, dest, source);
    return link.OnFrame(fields, userdata);
}
Пример #23
0
 void update_values()
 {
   std::vector<const mesh::FieldBase *> fields(m_values_field.begin(), m_values_field.end());
   if (m_mesh_modified) {
     // Copy coordinates to the newly ghosted nodes
     m_mesh_modified = false;
     fields.push_back(&m_coordinates_field);
   }
   mesh::communicate_field_data( *m_transfer_entity_ghosting , fields);
   mesh::copy_owned_to_shared  (  m_bulk_data, fields );
 }
Пример #24
0
 void FieldInfos::add(DocumentPtr doc)
 {
     SyncLock syncLock(this);
     Collection<FieldablePtr> fields(doc->getFields());
     for (Collection<FieldablePtr>::iterator field = fields.begin(); field != fields.end(); ++field)
     {
         add((*field)->name(), (*field)->isIndexed(), (*field)->isTermVectorStored(), 
             (*field)->isStorePositionWithTermVector(), (*field)->isStoreOffsetWithTermVector(), 
             (*field)->getOmitNorms(), false, (*field)->getOmitTermFreqAndPositions());
     }
 }
Пример #25
0
QMap<QString, int> QgsVectorDataProvider::fieldNameMap() const
{
  QMap<QString, int> resultMap;

  const QgsFields& theFields = fields();
  for ( int i = 0; i < theFields.count(); ++i )
  {
    resultMap.insert( theFields[i].name(), i );
  }

  return resultMap;
}
Пример #26
0
Файл: pvs.c Проект: jff/mathspad
static void handle_pvs_buf(unsigned char *buffer)
{
  /* buffer contains "bufname&file&display&read_only" */
  int nf = fields(buffer);
  /* PVS version 2.1 used 4 fields, PVS version 2.2 uses 5 fields */
  if ((nf==4 || nf==5) && field[1]!=NILstr) {
    if (pvs_open_pvs_files) {
      open_temporary_file(field[0], field[1], field[2]!=NILstr,0);
    }
    unlink(field[1]);
  }
}
Пример #27
0
 void
 response(DynamicBuffer& db)
 {
     write(db, "HTTP/1.");
     write(db, rand(2) ? "0" : "1");
     write(db, " ", 100 + rand(401), " ");
     write(db, token());
     write(db, "\r\n");
     fields(db);
     body(db);
     write(db, "\r\n");
 }
Пример #28
0
QList<Model::Node*> Class::findSymbols(const QRegExp& symbolExp,Model::Node* source, FindSymbolMode mode,
		bool exhaustAllScopes)
{
	QList<Model::Node*> symbols;

	symbols << methods()->findAllSymbolDefinitions(symbolExp);
	symbols << fields()->findAllSymbolDefinitions(symbolExp);

	if (exhaustAllScopes || symbols.isEmpty())
		symbols << Node::findSymbols(symbolExp, source, mode, exhaustAllScopes);
	return symbols;
}
Пример #29
0
std::string Parser::field(const std::string& s, unsigned int f) const {
// PRE: f is a valid field number for s.
	assert(f >= 0 && f < fields(s));	
	std::stringstream line(s);
	std::string temp;
	int i = f;		// It can become negative (!).
	while (i >= 0) {
		line >> temp;
		i--;
	}
	return temp;
}
Пример #30
0
QMap<QString, int> QgsVectorDataProvider::fieldNameMap() const
{
  QMap<QString, int> resultMap;

  QgsFields fieldsCopy = fields();
  for ( int i = 0; i < fieldsCopy.count(); ++i )
  {
    resultMap.insert( fieldsCopy.at( i ).name(), i );
  }

  return resultMap;
}