コード例 #1
0
/*
 * Note: This shares a buffer with httpGetStaticRequestHdrs, so the returned value
 *       can no longer be used once httpGetStaticRequestHdrs is invoked.
 */
const char *httpGetRequestHdrs(WspHttpParms_t *parmPtr, const char *contentType,
                                  const char *contentLength)
{
   int headerSize = 0;
   char *date     = getRFC822Date();

   XPTDEBUG(("    httpGetRequestHdrs(%lx, %s, %s)\n", (unsigned long) parmPtr,
             contentType, contentLength));

   if ((parmPtr == NULL) || (parmPtr->request == NULL))
      return NULL;

   headerSize += getTagLen("Content-Type", contentType);
   headerSize += getTagLen("Content-Length", contentLength);
   headerSize += getTagLen("Date", date);
   headerSize += getTagLen("Referer: ", parmPtr->request->referer);
   headerSize += xppStrlen(NL);
   headerSize += 1;              /* For null terminator */

   if (parmPtr->request->composedHeader != NULL)
      parmPtr->request->composedHeader = (char *) xppRealloc(parmPtr->request->composedHeader, headerSize);
   else
      parmPtr->request->composedHeader = (char *) xppMalloc(headerSize);

   if (parmPtr->request->composedHeader == NULL)
      return NULL;

   xppMemset(parmPtr->request->composedHeader, 0, headerSize);

   addTag(parmPtr->request->composedHeader, "Content-Type", contentType);
   addTag(parmPtr->request->composedHeader, "Content-Length", contentLength);
   addTag(parmPtr->request->composedHeader, "Date", date);
   addTag(parmPtr->request->composedHeader, "Referer", parmPtr->request->referer);
   xppStrcat(parmPtr->request->composedHeader, NL);

   XPTDEBUG(("    httpGetRequestHdrs() response = %s\n", parmPtr->request->composedHeader));

   return parmPtr->request->composedHeader;
} /* End httpGetRequestHdrs */
コード例 #2
0
ファイル: rust.c プロジェクト: relaxdiego/ctags
/* Mod format:
 * "mod" <ident> "{" [<body>] "}"
 * "mod" <ident> ";"*/
static void parseMod (lexerState *lexer, vString *scope, int parent_kind)
{
	advanceToken(lexer, TRUE);
	if (lexer->cur_token != TOKEN_IDENT)
		return;

	addTag(lexer->token_str, NULL, K_MOD, lexer->line, lexer->pos, scope, parent_kind);
	addToScope(scope, lexer->token_str);

	advanceToken(lexer, TRUE);

	parseBlock(lexer, TRUE, K_MOD, scope);
}
コード例 #3
0
void TagsView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
{
	switch(key)
	{
	case KEY_ENTER:
	case KEY_RETURN:
		if(IsFocused(tagInput))
		{
			addTag();
		}
		break;
	}
}
コード例 #4
0
ファイル: Entity.cpp プロジェクト: Zylann/SnowfeetEngine
//------------------------------------------------------------------------------
void Entity::unserializeState(const Variant & o, const SerializationContext & context)
{
    // Name
    m_name = o["name"].getString();
    
    // Enabled flag
    bool bEnabled = false;
    sn::unserialize(o["enabled"], bEnabled, true);
    setFlag(SN_EF_ENABLED, bEnabled);

    // Deserialize tags
    removeAllTags();
    std::unordered_set<std::string> tags;
    sn::unserialize(o["tags"], tags);
    for (auto it = tags.begin(); it != tags.end(); ++it)
    {
        const std::string & tagName = *it;
        addTag(tagName);
    }

    // Script
    auto & script = o["script"];
    if (script.isDictionary())
    {
        std::string classPath = script["class"].getString();
        if (!classPath.empty())
        {
            // TODO should be context.squirrelVM
            HSQUIRRELVM vm = Application::get().getScriptManager().getVM();

            if (m_script.create(vm, classPath))
            {
                // Set the "entity" member
                if (pushScriptObject(vm))
                {
                    HSQOBJECT entityObj;
                    sq_getstackobj(vm, -1, &entityObj);
                    m_script.setMember("entity", entityObj);
                    sq_pop(vm, 1); // pop entityObj
                }

				// Call onCreate
				m_script.callMethod("onCreate");
            }
        }
    }

    // TODO Unserialize script members

}
コード例 #5
0
ファイル: posture.cpp プロジェクト: aaronguo1996/posture
void Posture::toProfile(const QString &name)
{
	CloseCurrentWindow();
	modelList.clear();
	m_pwProfileWin = new ProfileWindow(this,name);
	m_wtCurrentWin = PROFILE;
	connect(m_pwProfileWin, SIGNAL(toHome()), this, SLOT(toHomeWin()));
	connect(m_pwProfileWin, SIGNAL(toProfileMode(const QString&)), this, SLOT(toProfileMode(const QString&)));
	connect(m_pwProfileWin, SIGNAL(toUpload()), this, SLOT(toUploadMode()));
	connect(m_pwProfileWin, SIGNAL(edit()), this, SLOT(toProfileEdit()));
	connect(m_pwProfileWin, SIGNAL(logout()), this, SLOT(logout()));
	connect(m_pwProfileWin, SIGNAL(addTag()), this, SLOT(toTag()));
	this->setCentralWidget(m_pwProfileWin);
}
コード例 #6
0
ファイル: rust.c プロジェクト: relaxdiego/ctags
/* Static format:
 * "static" ["mut"] <ident>
 */
static void parseStatic (lexerState *lexer, vString *scope, int parent_kind)
{
	advanceToken(lexer, TRUE);
	if (lexer->cur_token != TOKEN_IDENT)
		return;
	if (strcmp(lexer->token_str->buffer, "mut") == 0)
	{
		advanceToken(lexer, TRUE);
	}
	if (lexer->cur_token != TOKEN_IDENT)
		return;

	addTag(lexer->token_str, NULL, K_STATIC, lexer->line, lexer->pos, scope, parent_kind);
}
コード例 #7
0
ファイル: ocaml.c プロジェクト: b4n/fishman-ctags
/* parse the ~label and ~label:type parameter */
static void parseLabel (vString * const ident, ocaToken what)
{
	static int parCount = 0;

	switch (what)
	{
	case OcaIDENTIFIER:
		if (!dirtySpecialParam)
		{

			if (exportLocalInfo)
				addTag (ident, K_VAR);

			dirtySpecialParam = TRUE;
		}
		break;

	case Tok_PARL:
		parCount++;
		break;

	case Tok_PARR:
		parCount--;
		if (parCount == 0)
			toDoNext = &letParam;
		break;

	case Tok_Op:
		if (ident->buffer[0] == ':')
		{
			toDoNext = &ignoreToken;
			comeAfter = &letParam;
		}
		else if (parCount == 0 && dirtySpecialParam)
		{
			toDoNext = &letParam;
			letParam (ident, what);
		}
		break;

	default:
		if (parCount == 0 && dirtySpecialParam)
		{
			toDoNext = &letParam;
			letParam (ident, what);
		}
		break;
	}
}
コード例 #8
0
void XMLConfigDeltaWriter::write() {
	addTag(CONFIG, false);
	const std::map<std::string,XMLConfigDeltaGroup*> &groups = myConfigDelta.myGroups;
	for (std::map<std::string,XMLConfigDeltaGroup*>::const_iterator it = groups.begin(); it != groups.end(); ++it) {
		const std::map<std::string,XMLConfigValue> &values = it->second->myValues;
		const std::set<std::string> &removed = it->second->myRemovedNames;
		if (!values.empty() || !removed.empty()) {
			addTag(GROUP, false);
			addAttribute(NAME, AsciiEncoder::encode(it->first));
			for (std::map<std::string,XMLConfigValue>::const_iterator jt = values.begin(); jt != values.end(); ++jt) {
				addTag(OPTION, true);
				addAttribute(NAME, AsciiEncoder::encode(jt->first));
				addAttribute(VALUE, AsciiEncoder::encode(jt->second.Value));
				addAttribute(CATEGORY, jt->second.Category);
			}
			for (std::set<std::string>::const_iterator kt = removed.begin(); kt != removed.end(); ++kt) {
				addTag(OPTION, true);
				addAttribute(NAME, AsciiEncoder::encode(*kt));
			}
			closeTag();
		}
	}
	closeTag();
}
コード例 #9
0
bool QgsStyleV2::tagSymbol( StyleEntity type, QString symbol, QStringList tags )
{
  if ( !mCurrentDB )
  {
    QgsDebugMsg( "Sorry! Cannot open database to tag." );
    return false;
  }

  int symbolid = type == SymbolEntity ? symbolId( symbol ) : colorrampId( symbol );
  if ( !symbolid )
  {
    QgsDebugMsg( "No such symbol for tagging in database: " + symbol );
    return false;
  }


  foreach ( const QString &tag, tags )
  {
    // sql: gets the id of the tag if present or insert the tag and get the id of the tag
    char *query = sqlite3_mprintf( "SELECT id FROM tag WHERE name='%q'", tag.toUtf8().constData() );

    sqlite3_stmt *ppStmt;
    int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL );

    int tagid;
    if ( nErr == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW )
    {
      tagid = sqlite3_column_int( ppStmt, 0 );
    }
    else
    {
      tagid = addTag( tag );
    }

    sqlite3_finalize( ppStmt );

    // Now map the tag to the symbol
    query = type == SymbolEntity
            ? sqlite3_mprintf( "INSERT INTO tagmap VALUES (%d,%d)", tagid, symbolid )
            : sqlite3_mprintf( "INSERT INTO ctagmap VALUES (%d,%d)", tagid, symbolid );

    char *zErr = 0;
    nErr = sqlite3_exec( mCurrentDB, query, NULL, NULL, &zErr );
    if ( nErr )
    {
      QgsDebugMsg( zErr );
    }
  }
コード例 #10
0
ファイル: rust.c プロジェクト: relaxdiego/ctags
/*
 * Macro rules format:
 * "macro_rules" "!" <ident> <macro_body>
 */
static void parseMacroRules (lexerState *lexer, vString *scope, int parent_kind)
{
	advanceToken(lexer, TRUE);

	if (lexer->cur_token != '!')
		return;

	advanceToken(lexer, TRUE);

	if (lexer->cur_token != TOKEN_IDENT)
		return;

	addTag(lexer->token_str, NULL, K_MACRO, lexer->line, lexer->pos, scope, parent_kind);

	skipMacro(lexer);
}
コード例 #11
0
ファイル: Enemy.cpp プロジェクト: Ormanus/Jopnal-Demo
void Enemy::init()
{
    auto o = getObject();
    o->addTag("target");

    //drawable
    auto& drawable = o->createComponent<jop::GenericDrawable>(getObject()->getScene().getRenderer());
    drawable.setModel(jop::Model(jop::Mesh::getDefault(), jop::ResourceManager::getExistingResource<jop::Material>("cubeMaterial")));

    setHealth(100.f);
    m_speed = 8.f;
    m_currentWaypoint = 0;

    m_reward = 10;
    //m_maxWaypoint = -1;
}
コード例 #12
0
ファイル: rust.c プロジェクト: relaxdiego/ctags
/* Trait format:
 * "trait" <ident> [<type_bounds>] "{" [<body>] "}"
 */
static void parseTrait (lexerState *lexer, vString *scope, int parent_kind)
{
	int goal_tokens[] = {'{'};

	advanceToken(lexer, TRUE);
	if (lexer->cur_token != TOKEN_IDENT)
		return;

	addTag(lexer->token_str, NULL, K_TRAIT, lexer->line, lexer->pos, scope, parent_kind);
	addToScope(scope, lexer->token_str);

	advanceToken(lexer, TRUE);

	skipUntil(lexer, goal_tokens, 1);

	parseBlock(lexer, TRUE, K_TRAIT, scope);
}
コード例 #13
0
bool CInMemoryBuffer::addTagSafe(PCTAG_NAME tn)
{
	bool ret;

	//utils_debug("wlock 4\n");
	WriteLock();
	if(!lock_rtdb(__false, 100)){
		//utils_debug("release 8\n");
		Release();
		return __false;
	}
	ret = addTag(tn);
	unlock_rtdb();

	//utils_debug("release 9\n");
	Release();
	return ret;
}
コード例 #14
0
GuiSettingsStack_questions::GuiSettingsStack_questions(QWidget *parent)
{
  setIcon(":/img/img/question.png");
  setTitle("Settings");
  setSubTitle("questions");
  addTag("About Hive!");

//  QFormLayout *formLayout = new QFormLayout;
//  formLayout->setRowWrapPolicy(QFormLayout::WrapLongRows);
//  formLayout->addRow("Author:", new QLabel("Tim Zheng", this));
//  formLayout->addRow("Why Hive?", new QLabel("Hive is designed for users who don't get Internet access. It enables users to chat in LAN (Limited Area Network) connection. For example, you can chat with your friend with the connection to the same WiFi router which guarantees that you are in the same LAN network and you can send data to each other. Accroding to the principle it works, the router hive is working with doesn't necessarily need to connect the Internet Cable.", this));
//  central_layout->addLayout(formLayout);

  addItem("Author:", "<b>Tim Zheng</b>");
  addItem("Why Hive?", "Hive is designed for users without <b>Internet Access</b>. \nIt enables users to chat in <b>LAN</b> (Limited Area Network) connection.");

  this->setParent(parent);
}
コード例 #15
0
ファイル: kmetadatatagcloud.cpp プロジェクト: vasi/kdelibs
void Nepomuk::TagCloud::updateTags()
{
    // clear the tag cloud
    clear();

    // retrieve the list of all tags
    QList<Tag> tags = Tag::allTags();

    // count the number of usages of the tags and add them to the cloud
    for( QList<Tag>::iterator it = tags.begin();
         it != tags.end(); ++it ) {
        Tag& tag = *it;
        if ( tag.label().isEmpty() ) {
            tag.setLabel( tag.genericLabel() );
        }
        addTag( tag.label(), tag.tagOf().count() );
    }
}
コード例 #16
0
ファイル: objc.c プロジェクト: simlrh/ctags
static void parseStructMembers (vString * const ident, objcToken what)
{
	static parseNext prev = NULL;

	if (prev != NULL)
	{
		comeAfter = prev;
		prev = NULL;
	}

	switch (what)
	{
	case ObjcIDENTIFIER:
		vStringCopy (tempName, ident);
		break;

	case Tok_semi:	/* ';' */
		addTag (tempName, K_FIELD);
		vStringClear (tempName);
		break;

		/* some types are complex, the only one
		 * we will loose is the function type.
		 */
	case Tok_CurlL:	/* '{' */
	case Tok_PARL:	/* '(' */
	case Tok_SQUAREL:	/* '[' */
		toDoNext = &ignoreBalanced;
		prev = comeAfter;
		comeAfter = &parseStructMembers;
		ignoreBalanced (ident, what);
		break;

	case Tok_CurlR:
		toDoNext = comeAfter;
		break;

	default:
		/* don't care */
		break;
	}
}
コード例 #17
0
void ofxXmlSettings::serialize(const ofAbstractParameter & parameter){
	if(!parameter.isSerializable()) return;
	string name = parameter.getEscapedName();
	if(name=="") name="UnknownName";
	if(parameter.type()==typeid(ofParameterGroup).name()){
		const ofParameterGroup & group = static_cast<const ofParameterGroup&>(parameter);
		if(!tagExists(name)) addTag(name);
		pushTag(name);
		for(int i=0;i<group.size();i++){
			serialize(group.get(i));
		}
		popTag();
	}else{
		string value = parameter.toString();
		if(!tagExists(name))
			addValue(name,value);
		else
			setValue(name,value);
	}
}
コード例 #18
0
void 
CTagEntityMng::registerTag(const unsigned long  id, 
                           const std::string    &tag, 
                           const bool           unique
                           )
{
  // Check before insert
  TMTagId::iterator it = mTagEU.find( tag);
  if ( it != mTagEU.end() ) return;
  
  // Add Tag => List of entity
  if ( unique){
    addUniqueTag( id, tag);
  }
  else {
    addTag( id, tag);
  }
  // Add Entity => list of tag
  addForEntity( id, tag);
}
コード例 #19
0
ファイル: ocaml.c プロジェクト: b4n/fishman-ctags
/* parse :
 * module name = ...
 * then pass the token stream to moduleSpecif */
static void moduleDecl (vString * const ident, ocaToken what)
{
	switch (what)
	{
	case OcaKEYWORD_type:
		/* just ignore it, name come after */
		break;

	case OcaIDENTIFIER:
		addTag (ident, K_MODULE);
		vStringCopy (lastModule, ident);
		waitedToken = Tok_EQ;
		comeAfter = &moduleSpecif;
		toDoNext = &contextualTillToken;
		break;

	default:	/* don't care */
		break;
	}
}
コード例 #20
0
ファイル: RaceTags.cpp プロジェクト: arijitvt/EventRacer
RaceTags::RaceTagSet RaceTags::getEventRaceClasses(const VarsInfo::VarData& var) const {
	bool actual_race = false;
	std::set<int> race_reads;
	for (size_t i = 0; i < var.m_accesses.size(); ++i) {
		if (!var.m_accesses[i].m_isRead) continue;
		int num_reads_till_file = numReadCmdsUntilEventFire(var.m_accesses[i].m_eventActionId, var.m_accesses[i].m_commandIdInEvent);
		if (num_reads_till_file == -1) continue;
		if (num_reads_till_file == 0) actual_race = true;
		race_reads.insert(var.m_accesses[i].m_eventActionId);
	}
	if (race_reads.empty()) return emptyTagSet();  // Not an event variable.
	for (size_t i = 0; i < var.m_allRaces.size(); ++i) {
		const VarsInfo::RaceInfo& race = m_races.races()[var.m_allRaces[i]];
		// Unload races should not matter for events.
		if (isUnloadOp(race.m_event1) || isUnloadOp(race.m_event2)) continue;
		// Only if a race does not involve event invocation, do not return an event race tag.
		if (race_reads.count(race.m_event1) == 0 && race_reads.count(race.m_event2) == 0) return emptyTagSet();
	}
	return addTag(emptyTagSet(), actual_race ? RaceTags::LATE_EVENT_ATTACH : RaceTags::NO_EVENT_ATTACHED);
}
コード例 #21
0
ファイル: Alien.cpp プロジェクト: adlawren/PolySpaceInvaders
Alien::Alien( const String &file_name, const unsigned &sprite_width, const unsigned &sprite_height, const float &explosion_duration )
	: SpaceInvadersEntity( file_name, sprite_width, sprite_height )
{
	// scale the sprite
	setScale( Vector3( 0.75, 0.75, 0 ) ); 

	// add a tag
	addTag( "alien" );

	// initialize animations
	addAnimation( "frame_0", "0", 1 );
	addAnimation( "frame_1", "1", 1 );
	addAnimation( "explode", "2", 1 );

	playAnimation( "frame_0", 0, false );

	_timer = 0;
	_current_frame = 0;
	_explosion_duration = explosion_duration;
}
コード例 #22
0
Fighter::Fighter()
	: SpaceInvadersEntity( "Resources/fighter_1_test.png", 85, 53 )
{
	//
	addTag("fighter");

	addAnimation( "frame_0", "0", 1 );
	addAnimation( "explode", "1", 1 );

	playAnimation( "frame_0", 0, false );

	// set the explosion duration
	_explosion_duration = 1000;

	_timer = new Timer( false, 0 );
	_cooldown_timer = new Timer( false, 0 );

	_timer->Pause( true );

	_num_lives = 3;
}
コード例 #23
0
ファイル: objc.c プロジェクト: simlrh/ctags
static void parseStruct (vString * const ident, objcToken what)
{
	switch (what)
	{
	case ObjcIDENTIFIER:
		if (!parseStruct_gotName)
		{
			addTag (ident, K_STRUCT);
			pushEnclosingContext (ident, K_STRUCT);
			parseStruct_gotName = TRUE;
		}
		else
		{
			parseStruct_gotName = FALSE;
			popEnclosingContext ();
			toDoNext = comeAfter;
			comeAfter (ident, what);
		}
		break;

	case Tok_CurlL:
		toDoNext = &parseStructMembers;
		break;

		/* maybe it was just a forward declaration
		 * in which case, we pop the context */
	case Tok_semi:
		if (parseStruct_gotName)
			popEnclosingContext ();

		toDoNext = comeAfter;
		comeAfter (ident, what);
		break;

	default:
		/* we don't care */
		break;
	}
}
コード例 #24
0
ファイル: captureform.cpp プロジェクト: jusko/recap-ui
//------------------------------------------------------------------------------
// Connect all signals/slots
//------------------------------------------------------------------------------
void CaptureForm::setConnections(const QtSerializerWrapper& writer) {
    connect(m_titleEdit, SIGNAL(textEdited(QString)),
            this, SLOT(setItemTitle(QString)));

    connect(m_tagsEdit, SIGNAL(editingFinished()),
            this, SLOT(setTags()));

    connect(m_tagsBox, SIGNAL(activated(QString)),
            this, SLOT(addTag(QString)));

    connect(m_contentEdit, SIGNAL(textChanged()),
            this, SLOT(updateContentNotes()));

    connect(this, SIGNAL(requestWrite(QtItemWrapper)),
            &writer, SLOT(write(QtItemWrapper)));

    connect(m_okButton, SIGNAL(clicked(bool)),
            this, SLOT(acceptForm(bool)));

    connect(m_cancelButton, SIGNAL(clicked(bool)),
            this, SLOT(rejectForm(bool)));
}
コード例 #25
0
ファイル: ocaml.c プロジェクト: b4n/fishman-ctags
/* parse :
 * class name = ...
 * or
 * class virtual ['a,'b] classname = ... */
static void classDecl (vString * const ident, ocaToken what)
{
	switch (what)
	{
	case OcaIDENTIFIER:
		addTag (ident, K_CLASS);
		vStringCopy (lastClass, ident);
		toDoNext = &contextualTillToken;
		waitedToken = Tok_EQ;
		comeAfter = &classSpecif;
		break;

	case Tok_BRL:
		toDoNext = &tillToken;
		waitedToken = Tok_BRR;
		comeAfter = &classDecl;
		break;

	default:
		break;
	}
}
コード例 #26
0
ファイル: player.cpp プロジェクト: 10098/braveball
 Player::Player(const Engine& e, int x, int y):
    GameObject(x, y),
    m_landSound(e.resourceManager().getSound("land.wav"), false),
    m_jumpSound(e.resourceManager().getSound("jump.wav"), false),
    m_hurtSound(e.resourceManager().getSound("hurt.wav"), false),
    m_heartSound(e.resourceManager().getSound("heart.wav"), false),
    m_heartPtsSound(e.resourceManager().getSound("heart_nopickup.wav"), false),
    m_dashSound(e.resourceManager().getSound("dash.wav"), false),
    m_speed(1),
    m_direction(1),
    m_lives(4),
    m_hurt(false),
    m_reachedExit(false),
    m_hurtTime(-1),
    m_fallSpeed(0),
    m_accelerationThr(15),
    m_posUpdateThr(15),
    m_jumpState(Standing),
    m_moveForward(false),
    m_breakJump(false),
    m_currentPlatformStart(0),
    m_currentPlatformEnd(9000),
    m_minX(0),
    m_dashing(false),
    m_dashStart(0),
    m_power(0),
    m_canDash(false)
 {
    addTag("player");
    const char* anim_names[] = {"run_right", "run_left", "jump_right", "jump_left", "wait_right", "wait_left", "land_right", "land_left", "fall_right", "fall_left"};
    for(int i = 0; i < sizeof(anim_names)/sizeof(char*); ++i)
    {
       m_anims.addAnim(anim_names[i], graphics::Animation(e.resourceManager().getAnimationData(std::string("ball/") + anim_names[i])));
    }
    m_anims.setCurrentAnim("wait_right");
    setWidth(m_anims.currentAnim().frame().w);
    setHeight(m_anims.currentAnim().frame().h);
 }
コード例 #27
0
ファイル: RedUfo.cpp プロジェクト: adlawren/PolySpaceInvaders
RedUfo::RedUfo( const unsigned screen_width )
	: SpaceInvadersEntity( "Resources/red_ufo.png", 155, 68 )
{
	//
	setScale( Vector3( 0.5, 0.5, 0 ) );
	
	// randomly choose which side to approach from
	srand( time(0) );

	_current_direction = Direction( rand() % 2 );

	switch ( _current_direction ) {
	case left:
		// start on the right
		Translate( Vector3( screen_width - getWidth() + 10, 100, 0 ) - getPosition() );
		break;
	case right:
		Translate( Vector3( getWidth() + 10, 100, 0 ) - getPosition() );
		break;
	}

	addTag("redUFO");
}
コード例 #28
0
ファイル: objc.c プロジェクト: simlrh/ctags
static void parseEnum (vString * const ident, objcToken what)
{
	switch (what)
	{
	case ObjcIDENTIFIER:
		if (!parseEnum_named)
		{
			addTag (ident, K_ENUM);
			pushEnclosingContext (ident, K_ENUM);
			parseEnum_named = TRUE;
		}
		else
		{
			parseEnum_named = FALSE;
			popEnclosingContext ();
			toDoNext = comeAfter;
			comeAfter (ident, what);
		}
		break;

	case Tok_CurlL:	/* '{' */
		toDoNext = &parseEnumFields;
		parseEnum_named = FALSE;
		break;

	case Tok_semi:	/* ';' */
		if (parseEnum_named)
			popEnclosingContext ();
		toDoNext = comeAfter;
		comeAfter (ident, what);
		break;

	default:
		/* don't care */
		break;
	}
}
コード例 #29
0
ファイル: tranlogentry.cpp プロジェクト: jrharshath/hisaab
bool TranlogEntry::fromString(QString strNotation) {
	QStringList parts = strNotation.split("\t");
	Q_ASSERT_X(parts.size()==4, "TranlogEntry::fromString(Qstring)", "Invalid file format!");


	QString dtstring = parts.at(0);
	QString amountstring = parts.at(1);
	QString messagestring = parts.at(2);
	QString tagslist = parts.at(3);

	HisaabDateTime date;
	bool ok = date.fromString(dtstring);
	if( !ok ) return false;
	setDateTime(date);

	if( !isFloat(amountstring) ) return false;
	setAmount( amountstring.toFloat() );

	setMessage(messagestring);

	QStringList tags = tagslist.split(" ");
	foreach(QString tag, tags) {
		addTag(tag);
	}
コード例 #30
0
ファイル: player.cpp プロジェクト: vidarn/mgrl
Player::Player(int race):
    Creature()
{
    m_race = race;
    m_glyph = 3;
    m_running = false;
    m_hitDie = 12;
    m_hp = m_maxHp = m_hitDie;
    m_exp = 0;
    m_hd = 1;
    m_expForNextLevel = 1000;
    m_name = "You";
    m_mana[0] = m_maxMana[0] = 0;
    m_mana[1] = m_maxMana[1] = 0;
    m_mana[2] = m_maxMana[2] = 0;
    /*m_allSpells.push_back(new AbDefensiveStance(AB_DEFENSIVE_STANCE));
    m_allSpells.push_back(new AbBlastTrap(AB_BLAST_TRAP,0));
    m_allSpells.push_back(new AbSmallManaStream(AB_SMALL_MANA_STREAM, COLOR_BLUE));
    m_allSpells.push_back(new AbInstantTunnel(AB_INSTANT_TUNNEL));
    m_allSpells.push_back(new AbSmallManaStream(AB_SMALL_MANA_STREAM, COLOR_RED));
    m_allSpells.push_back(new AbBlink(AB_BLINK));
    m_allSpells.push_back(new AbBlink(AB_BLINK));
    m_allSpells.push_back(new AbSacredNectar(AB_SACRED_NECTAR));
    m_allSpells.push_back(new AbLightningBolt(AB_LIGHTNING_BOLT));
    m_allSpells.push_back(new AbSmallManaStream(AB_SMALL_MANA_STREAM, COLOR_WHITE));

    for(int i=0;i<m_allSpells.size();i++){
        m_deck.push_back(m_allSpells[i]);
        if(i<4){
            m_abilities.push_back(m_allSpells[i]);
        }
    }
    restockLibrary();*/

    addTag(TAG_PLAYER);
}