示例#1
1
void SoD00V::ReadHeader(QDataStream &datastr){
	QMutexLocker locker(&readmutex);
	char tmp[4];
	for(int i=0;i<252;i++){
		char c=0;
		datastr.readRawData(&c,1);
		Set_description(Description()+ QChar(c));
	}
	datastr.readRawData(tmp,2);
	datastr.readRawData(tmp,1);
	Set_NADC( tmp[0]);
	datastr.readRawData(tmp,1);
	char nmon=tmp[0]*4;
	if(nmon>63){
		nmon=63;
		Set_Warning();
		error("Data header contains wrong data about monitor detectors count.");
	}
	for(int i=0; i<63; i++){
		uint cnt=0;
		datastr.readRawData((char*)&cnt,4);
		double val=cnt;
		if(i<nmon)
			ApplyConstant("M#"+QString::number(i),val);
	}
	m_events_header=0;
	datastr.readRawData((char*)&m_events_header,4);
}
示例#2
0
QgsGrassModule::Description QgsGrassModule::description( QString path )
{
  QgsDebugMsg( "called." );

  // Open QGIS module description
  path.append( ".qgm" );
  QFile qFile( path );
  if ( !qFile.exists() )
  {
    return Description( tr( "Not available, description not found (%1)" ).arg( path ) );
  }
  if ( ! qFile.open( QIODevice::ReadOnly ) )
  {
    return Description( tr( "Not available, cannot open description (%1)" ).arg( path ) );
  }
  QDomDocument qDoc( QStringLiteral( "qgisgrassmodule" ) );
  QString err;
  int line, column;
  if ( !qDoc.setContent( &qFile,  &err, &line, &column ) )
  {
    QString errmsg = tr( "Cannot read module file (%1)" ).arg( path )
                     + tr( "\n%1\nat line %2 column %3" ).arg( err ).arg( line ).arg( column );
    QgsDebugMsg( errmsg );
    QMessageBox::warning( 0, tr( "Warning" ), errmsg );
    qFile.close();
    return Description( tr( "Not available, incorrect description (%1)" ).arg( path ) );
  }
  qFile.close();
  QDomElement qDocElem = qDoc.documentElement();

  QString label = QApplication::translate( "grasslabel", qDocElem.attribute( QStringLiteral( "label" ) ).trimmed().toUtf8() );
  bool direct = qDocElem.attribute( QStringLiteral( "direct" ) ) == QLatin1String( "1" );
  return Description( label, direct );
}
DragValueCtrl* grid_text(wxWindow* parent,
  wxSizer* sizer,
  winvec_t& showhide,
  const Art& art,
  StatusInterface& statusInfo,
  const DialogFunc& showDialog)
{
  // Create the drag-adjustable grid spacing text

  auto text = make_wx<DragValueCtrl>(parent,
    IntRange(min_t(1)),
    Description(
     "Grid: Drag to adjust spacing. "
     "Right-Click to disable. "
     "Double-click for dialog"),
    DragCursor(art.Get(Cursor::DRAG_SCALE)),
    HoverCursor(art.Get(Cursor::MOVE_POINT)),
    statusInfo);
  showhide.push_back(text);
  text->Hide();

  events::on_mouse_left_double_click(text,
    [=](const IntPoint&){
      showDialog();
    });

  sizer->Add(text, 0, wxALIGN_CENTER_VERTICAL);
  return text;
}
示例#4
0
void Attack::Act(IGame& game) const
{
	State attacker = game.Get(actor);
	auto& targetActor = dynamic_cast<const Identity&>(target);
	State victim(game.Get(targetActor));
	if (!part)
	{
		Engage(attacker);
		game.Adjust(actor, attacker, skill.name);
		game.Adjust(targetActor, victim, L"Miss " + skill.name);
		return;
	}
	auto skillLevel = attacker.SkillLevel(skill, &victim);
	if (skillLevel.Value() == 0)
	{
		Engage(attacker);
		game.Adjust(actor, attacker, skill.name);
		game.Adjust(targetActor, victim, L"Resist " + skill.name + L":" + skillLevel.Description());
		return;
	}
	auto damage = attacker.AttackDamage(skill, skillLevel);
	Damage pain = damage - victim.Mitigation(*part);
	if (!victim.Hurt(*part, pain, actor.Description()+L"'"+skill.description))	
	{
		Engage(attacker);
		game.Adjust(actor, attacker, skill.name);
		game.Adjust(targetActor, victim, L"Mitigate " + skill.name + L"@" + part->Name() + L":" + pain.ActionDescription());
		return;
	}
	Engage(attacker);
	game.Adjust(actor, attacker, skill.name);
	game.Adjust(targetActor, victim, L"Hit " + skill.name + L"@" + part->Name() + L":" + pain.ActionDescription());
}
示例#5
0
bool
TransferQueueRequest::SendGoAhead(XFER_QUEUE_ENUM go_ahead,char const *reason) {
	ASSERT( m_sock );

	m_sock->encode();
	ClassAd msg;
	msg.Assign(ATTR_RESULT,(int)go_ahead);
	if( reason ) {
		msg.Assign(ATTR_ERROR_STRING,reason);
	}

		// how often should transfer processes send a report of I/O activity
		//   0 means never
	int report_interval = param_integer("TRANSFER_IO_REPORT_INTERVAL",10,0);
	msg.Assign(ATTR_REPORT_INTERVAL,report_interval);

	if(!putClassAd( m_sock, msg ) || !m_sock->end_of_message()) {
		dprintf(D_ALWAYS,
				"TransferQueueRequest: failed to send GoAhead to %s\n",
				Description() );
		return false;
	}

	m_gave_go_ahead = true;
	m_time_go_ahead = time(NULL);
	return true;
}
示例#6
0
int main(int ac, const char* av[])
{
  try
  {
    if(ac != 3) throw Exception("Usage: CreateTicks <filename> <number of ticks>");
    const char* filename = av[1];
    int n = boost::lexical_cast<int>(av[2]);

    //  create sample ticks
    clockTime = boost::posix_time::second_clock::local_time();
    auto tf = TeaFile<Tick>::Create(filename);
    cout << tf->Description() << endl;
    for(int i=0; i < n; i++)
    {
      tf->Write(GetRandomTick());
    }
    cout << "added " << n << " Ticks" << endl;
  }
  catch(exception &e)
  {
    cout << e.what() << endl;
    return -1;
  }
  catch(...)
  {
    cout << "unspecified error" << endl;
    return -1;
  }
  return 0;
}
示例#7
0
void configure() {
    ::configure();
    set_forfeit_name("death");
    set_forfeit_rarity(Rarity_Unusual);
    set_forfeit_value(Travelers_Forfeit_Value_Moderate);
    set_forfeit_initialize_description("death");
    set_forfeit_eligibility_condition(([
        Condition_Type_Code                     : Condition_Type_Trait,
        Condition_Info                          : Trait_Perdition,
        Condition_Flags                         : Condition_Flag_Inverse,
    ]));
    set_challenge_component_selection_adjustments(([
        "dismemberment"                         : 0.00,
        "dying"                                 : 0.00,
    ]));
    set_forfeit_message(([
        Message_Content                         : ({
            'a',
            ([
                Message_Content                 : ({
                    "ominous",
                }),
                Message_Senses                  : Message_Sense_Emotive,
            ]),
            "gong sound fills the", Description(Description_Type_Ambient_Medium_Colored_Name),
        }),
vector<MergerCreator::Description> HighwaySnapMergerCreator::getAllCreators() const
{
  vector<Description> result;

  result.push_back(Description(className(), "Highway Snap Merge Creator", false));

  return result;
}
vector<MergerCreator::Description> PoiPolygonMergerCreator::getAllCreators() const
{
  vector<Description> result;

  result.push_back(Description(className(), "POI to Polygon Merge Creator", true));

  return result;
}
 bool doSetFormat()
 {
   m_frameBuffer.resize(m_config.width() * m_config.height() * 4); // 4 bytes per pixel should be enought
   m_description = Description(m_config.width(), m_config.height(),
                               m_config.format(),
                               0, 0);
   return true;
 }
示例#11
0
const QString CameraDescription::ToPlainText() const
{
    const QString plainText( QString( "%1\n%2\n%3" )
                            .arg( QString::fromStdWString( Name() ) )
                            .arg( QString::fromStdWString( Description() ) )
                            .arg( QString::fromStdWString( UniqueId() ) ) );
    return plainText;
}
vector<MergerCreator::Description> PlacesPoiMergerCreator::getAllCreators() const
{
  vector<Description> result;

  result.push_back(Description(className(), "PLACES Merge Creator", false));

  return result;
}
示例#13
0
void CommandBase::PrintDescription(std::ostream& out)
{
	out<<"-"<<Name();
	for(size_t i=0; i<args.size(); i++) {
		out << " " << args[i].name;
	}
	out<<": "<<Description()<<endl;
}
示例#14
0
//Default version
bool OBPlugin::Display(string& txt, const char* param, const char* ID)
{
    //Use the provided ID if possible.
    if(ID)
        txt = ID;
    else
        txt = GetID();
    txt += "    ";// was '\t'; but caused problems in GUI menu
    if(param && !strcasecmp(param, "verbose"))
    {
        txt += Description();
        txt += '\n';
    }
    else
        txt += FirstLine(Description());
    return true;
}
std::string SetFieldValueCommand::getCommandDescription(void) const
{
    GetFieldHandlePtr TheFieldHandle = _FC->getField(_FieldId);

	std::string Description("");

    Description = Description + "Set " + TheFieldHandle->getDescription()->getName() + " to " + _Value;
	
	return Description;
}
std::string InsertFieldElementCommand::getCommandDescription(void) const
{
    GetFieldHandlePtr TheFieldHandle = _FC->getField(_FieldId);

	std::string Description("");

    Description = Description + "Insert " + _Value + " to " + TheFieldHandle->getDescription()->getName() + " at index " + boost::lexical_cast<std::string>(_Index);
	
	return Description;
}
示例#17
0
TEST(BookmarkTest,BookmarkCreation)
{
	std::wstring Name(L"Test name");
	std::wstring Location(L"Test location");
	std::wstring Description(L"Test description");
	CBookmark Bookmark(Name,Location,Description);

	EXPECT_EQ(Name,Bookmark.GetName());
	EXPECT_EQ(Location,Bookmark.GetLocation());
	EXPECT_EQ(Description,Bookmark.GetDescription());
}
示例#18
0
CString GetError(_com_error &e)
{	
	CString MsgBug;
	_bstr_t Source(e.Source());
	_bstr_t Description(e.Description());
	MsgBug.Format( "Ups!!! \nSource = %s\nDescription= %s\n",(LPCSTR)Source, (LPCSTR)Description );
	#ifdef _DEBUG
		AfxMessageBox( MsgBug, MB_OK | MB_ICONERROR );
	#endif	
	return MsgBug;
}
示例#19
0
文件: progress.cpp 项目: vata/xarino
void Progress::Start(BOOL Delay, UINT32 DescriptionID, INT32 IntendedFinalCount)
{
	if (!DescriptionID)
		Progress::Start(Delay, (StringBase *)NULL, IntendedFinalCount);
	else
	{
		String_256 Description(DescriptionID);

		Progress::Start(Delay, (StringBase *)&Description, IntendedFinalCount);
	}
}
示例#20
0
/*
 * Check for loops.
 */
bool ShowNetOutputPort::PreSetUniverse(Universe *old_universe,
                                       Universe *new_universe) {
  (void) old_universe;
  (void) new_universe;
  AbstractDevice *device = GetDevice();
  InputPort *input_port = device->GetInputPort(PortId());
  if (input_port && input_port->GetUniverse()) {
    OLA_WARN << "Avoiding possible shownet loop on " << Description();
    return false;
  }
  return true;
}
std::string SwapFieldElementCommand::getCommandDescription(void) const
{
    GetFieldHandlePtr TheFieldHandle = _FC->getField(_FieldId);

	std::string Description("");

    Description = Description 
                + "Move " + TheFieldHandle->getDescription()->getName()
                + " index " + boost::lexical_cast<std::string>(_FromIndex) 
                + " to index " + boost::lexical_cast<std::string>(_ToIndex);
	
	return Description;
}
void CBkmrkProperties::TransSaveL()
	{
	SetModified ();
	
	TUint32 indexBase = IndexBase();
	TUint32 timeLo = I64LOW(iLastModified.Int64());
	TUint32 timeHi = I64HIGH(iLastModified.Int64());
	iRepository->Set(indexBase + KBkmrkLastModifiedLoIndex, static_cast<TInt>(timeLo));
	iRepository->Set(indexBase + KBkmrkLastModifiedHiIndex, static_cast<TInt>(timeHi));
	iRepository->Set(indexBase + KCmnDescriptionIndex, Description());
	iRepository->Set(indexBase + KCmnIconIndex, static_cast<TInt>(iIconId));
	iCustomProperties->TransSaveL();
	}
示例#23
0
void ToolButton::ResetKeepStyle()
{
	repeat = false;
	accel = 0;
	checked = false;
	NoWantFocus();
	minsize = Size(0, 0);
	maxiconsize = Size(INT_MAX, INT_MAX);
	Tip("");
	Help("");
	Topic("");
	Description("");
}
示例#24
0
void
MimeTypeItem::AddSubtype()
{
	if (fSubtype == Text())
		return;

	BString text = Description();
	text.Append(" (");
	text.Append(fSubtype);
	text.Append(")");

	SetText(text.String());
}
示例#25
0
const QString CameraDescription::ToRichText() const
{
    const QString richText( QCoreApplication::translate( "CameraDescription",
                              "<head/>\n"
                              "<body>\n"
                                  "<p><strong>Name:</strong> %1</p>\n"
                                  "<p><strong>Description:</strong> %2</p>\n"
                                  "<p><strong>Unique ID:</strong> %3</p>\n"
                              "</body>" )
                                .arg( QString::fromStdWString( Name() ) )
                                .arg( QString::fromStdWString( Description() ) )
                                .arg( QString::fromStdWString( UniqueId() ) ) );
    return richText;
}
示例#26
0
文件: store.cpp 项目: aosm/tcl
/// Define the complete view structure of the storage
void c4_Storage::SetStructure(const char *description_) {
  d4_assert(description_ != 0);

  if (description_ != Description()) {
    c4_String s = "[" + c4_String(description_) + "]";
    description_ = s;

    c4_Field *field = d4_new c4_Field(description_);
    d4_assert(! *description_);

    d4_assert(field != 0);
    Persist()->Root().Restructure(*field, false);
  }
}
示例#27
0
文件: compile.cpp 项目: glftpd/ebftpd
std::string CompileGroupRanks(const std::string& section, Timeframe tf, Direction dir, 
                              SortField sf, int max, text::Template& templ)
{
  auto groups = ::db::stats::CalculateGroupRanks(section, tf, dir, sf);
  
  std::ostringstream os;
  text::TemplateSection& head = templ.Head();
  head.RegisterValue("section", section.empty() ? "ALL" : section);
  os << head.Compile();
  
  text::TemplateSection& body = templ.Body();

  long long totalKBytes = 0;
  long long totalFiles = 0;
  long long totalXfertime = 0;

  int index = 0;
  unsigned total = 0;
  for (const auto& g : groups)
  {
    if (g.Files() <= 0) break;
    if (index < max)
    {
      auto group = acl::Group::Load(g.ID());
      body.RegisterValue("index", ++index);
      body.RegisterValue("group", group ? group->Name() : "unknown");
      body.RegisterValue("descr", group ? group->Description() : "");
      body.RegisterValue("files", g.Files());
      body.RegisterSize("size", g.KBytes());
      body.RegisterSpeed("speed", g.Speed());
      
      os << body.Compile();
    }
    
    totalKBytes += g.KBytes();
    totalFiles += g.Files();
    totalXfertime += g.Xfertime();
    ++total;
  }
  
  text::TemplateSection& foot = templ.Foot();
  foot.RegisterValue("groups", total);
  foot.RegisterSize("size", totalKBytes);
  foot.RegisterValue("files" ,totalFiles);
  foot.RegisterSpeed("speed", totalXfertime == 0 ? totalKBytes : totalKBytes / (totalXfertime / 1000.0));
  os << foot.Compile();
  
  return os.str();
}
示例#28
0
char const *
TransferQueueRequest::SinlessDescription() {
	char const *s = Description();
		// get rid of the sinful string, which is at the beginning of the description
	char const *pos = strchr(s,'>');
	if( pos ) {
		if( pos[1] == ' ' ) {
			s = pos+2;
		}
		else {
			s = pos+1;
		}
	}
	return s;
}
示例#29
0
void configure() {
    ::configure();
    set_forfeit_name("insanity");
    set_forfeit_rarity(Rarity_Very_Rare);
    set_forfeit_value(Travelers_Forfeit_Value_Very_High);
    set_forfeit_initialize_description("insanity and mania");
    set_forfeit_message(([
        Message_Content                         : ({
            'a',
            ([
                Message_Content                 : ({
                    "eerie",
                }),
                Message_Senses                  : Message_Sense_Emotive,
            ]),
            "chime sound fills the", Description(Description_Type_Ambient_Medium_Colored_Name),
        }),
示例#30
0
TEST(BookmarkTest,BookmarkUpdates)
{
	std::wstring Name(L"Test name");
	std::wstring Location(L"Test location");
	std::wstring Description(L"Test description");
	CBookmark Bookmark(Name,Location,Description);

	std::wstring NewName(L"New test name");
	Bookmark.SetName(NewName);
	EXPECT_EQ(NewName,Bookmark.GetName());

	std::wstring NewLocation(L"New test location");
	Bookmark.SetLocation(NewLocation);
	EXPECT_EQ(NewLocation,Bookmark.GetLocation());

	std::wstring NewDescription(L"New test description");
	Bookmark.SetDescription(NewDescription);
	EXPECT_EQ(NewDescription,Bookmark.GetDescription());
}