当前位置: 首页>>代码示例>>C++>>正文


C++ AList类代码示例

本文整理汇总了C++中AList的典型用法代码示例。如果您正苦于以下问题:C++ AList类的具体用法?C++ AList怎么用?C++ AList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: building_create

int
building_create(int type, int x, int y)
{
  Building* building;

  if (type == 1)
    {
      building = 0;
    }
  else
    {
      AList props;
      props.set_int("x-pos", x);
      props.set_int("y-pos", y);
      building = BuildingTypeManager::current()->create_building(type, props);
    }

  if (building)
    {
      BuildingManager::current()->add_building(building, x, y);
      return building->get_id();
    }
  else
    {
      std::cout << "BuildingCommands: Unhandled building type: " << type << std::endl;
      return 0;
    }
}
开发者ID:BackupTheBerlios,项目名称:feuerkraft-svn,代码行数:28,代码来源:building_commands.cpp

示例2: config

ADVBConfig::ADVBConfig() : config(AString(DEFAULTCONFDIR).CatPath("dvb"), false),
						   defaults(20, &AString::DeleteString),
						   webresponse(false)
{
	static const struct {
		const char *name;
		const char *value;
	} __defaults[] = {
		{"prehandle",  		 	"2"},
		{"posthandle", 		 	"3"},
		{"pri", 	   		 	"0"},
		{"dir",              	""},
		{"h264crf",      	 	"17"},
		{"maxvideorate", 	 	"2000k"},
		{"aacbitrate", 	 	 	"160k"},
		{"mp3bitrate", 	 	 	"160k"},
		{"copyvideo", 	 	 	"-vcodec copy"},
		{"copyaudio", 	 	 	"-acodec copy"},
		{"mp3audio",  	 	 	"-acodec mp3 -b:a {conf:mp3bitrate}"},
		{"h264preset",   	 	"veryfast"},
		{"h264bufsize",  	 	"3000k"},
		{"videodeinterlace", 	"yadif"},
		{"videofilter",  	 	"-filter:v {conf:videodeinterlace}"},
		{"filters",		 	 	"{conf:videofilter} {conf:audiofilter}"},
		{"encodeflags",	 	 	"-movflags +faststart"},
		{"h264video", 	 	 	"-vcodec libx264 -preset {conf:h264preset} -crf {conf:h264crf} -maxrate {conf:maxvideorate} -bufsize {conf:h264bufsize} {conf:encodeflags} {conf:filters}"},
		{"aacaudio",  	 	 	"-acodec libfdk_aac -b:a {conf:aacbitrate}"},
		{"encodecopy",   	 	"{conf:copyvideo} {conf:mp3audio}"},
		{"encodeh264",   	 	"{conf:h264video} {conf:aacaudio}"},
		{"encodeargs",   	 	"{conf:encodeh264}"},
		{"encodeaudioonlyargs", "{conf:mp3audio}"},
	};
	uint_t i;

	for (i = 0; i < NUMBEROF(__defaults); i++) {
		defaults.Insert(__defaults[i].name, (uptr_t)new AString(__defaults[i].value));
	}

	CreateDirectory(GetConfigDir());
	CreateDirectory(GetDataDir());
	CreateDirectory(GetLogDir());
	CreateDirectory(GetRecordingsStorageDir());
	CreateDirectory(GetRecordingsDir());
	CreateDirectory(GetTempDir());

	if (CommitScheduling()) {
		AList   users;
		AString dir;

		ListUsers(users);

		const AString *user = AString::Cast(users.First());
		while (user) {
			if (((dir = GetRecordingsDir(*user)).Valid())        && (dir.Pos("{") < 0)) CreateDirectory(dir);
			if (((dir = GetRecordingsArchiveDir(*user)).Valid()) && (dir.Pos("{") < 0)) CreateDirectory(dir);

			user = user->Next();
		}
	}
}
开发者ID:,项目名称:,代码行数:60,代码来源:

示例3: Building

Tower::Tower(const AList& lst) :
  Building(lst),
  towerbase(resources->get_sprite("feuerkraft/tower/base")),
  towerdamaged (resources->get_sprite("feuerkraft/tower/damaged")),
  towerdestroyed (resources->get_sprite("feuerkraft/tower/destroyed")),
  turret (resources->get_sprite("feuerkraft/tower/turret")),
  steering(),
  orientation(),
  energie (lst.get_int("start-energie", 100)),
  destroyed (false),
  pos()
{  
  //int energie;
  //std::cout << lst.retrieve_int("start-energie", energie) << std::endl;
  //std::cout << lst << std::endl;
  //std::cout << "Tower Energie: " << lst.get_int("start-energie", 100) << std::endl;
  //std::cout << "--Tower Energie: " << lst.get_int("sta-energie", 100) << std::endl;

  orientation = lst.get_float("orientation");
  pos.x = x_pos * 40 + 40;
  pos.y = y_pos * 40 + 40;

  steering = 0;

  Building::properties->register_float("orientation", &orientation);
}
开发者ID:BackupTheBerlios,项目名称:feuerkraft-svn,代码行数:26,代码来源:tower.cpp

示例4: main

int main(int argc, char** argv) {
  cout << "Starting ListTest" << endl;
  fstream successfile;
  AList AL;
  // LList LL = new LList();

  test(AL);
  // test(LL);
  AL.clear();
  //LL.clear();
  testAppend(AL);
  // testAppend(LL);

  if (SUCCESS) {
    successfile.open("success", ios::out);
    if (!successfile) {
      cout << "Unable to open SUCCESS file :";
      exit(-1);
    }
    successfile << "Success";
  }

  if (testsize == 0) {
    exit(-1);
    return 0;
  }
  /*
  println("Do the timing test");
  LList LT = new LList();
  time1 = millis();
  for (int i = 0; i < testsize; i++) {
    LL.insert(10);
    LL.insert(15);
    LL.insert(20);
    LL.insert(25);
    LL.clear();
  }
  time2 = millis();
  long totaltime = (time2-time1);
  println("Timing test on " + testsize + " iterations: " + totaltime);

  time1 = millis();
  for (int i = 0; i < testsize; i++) {
    Link temp = new Link(null, null);
    temp = new Link(null, null);
    temp = new Link(null, null);
    temp = new Link(null, null);
    temp = new Link(null, null);
  }
  time2 = millis();
  totaltime = (time2-time1);
  println("Timing test2 on " + testsize + " iterations: " + totaltime);
  */

  exit(-1);
  return 0;
} //end main
开发者ID:Sould32,项目名称:OpenDSA,代码行数:57,代码来源:ListTest.cpp

示例5: MatrixMult

void mlrVoiceManager::Exec(Tpoint *campos, Trotation *camrot, Tpoint *camvel){
	static const Tpoint upv = { 0, 0, 1 };
	static const Tpoint fwd = { 1, 0, 0 };

	MatrixMult(camrot, &upv, &listenerUp);
	MatrixMult(camrot, &fwd, &listenerFront);
	listenerPosition = *campos;
	listenerVelocity = *camvel;

	Lock();

	mlrVoice *n;
	int channels;
	channels=g_nDynamicVoices;
	// sort the PlayList, store in temp
	AList temp;
	while (n=(mlrVoice *)PlayList.RemHead()){
		n->PreExec();
		temp.AddSorted((ANode *)n);
	}

	// filter out what will be played
	while (n=(mlrVoice *)temp.RemHead()){
		if(( n->status==mlrVoice::VSSTART || n->status==mlrVoice::VSPLAYING ) && channels > 0){
			PlayList.AddTail(n); // maintain sortedness
			channels--;
		}
		else {
			n->ReleaseBuffers();
			HoldList.AddTail(n);		
		}
	}

	channels=g_nDynamicVoices;
	// make these allocate their sound buffers
	// then exec()
	if (SimDriver.MotionOn()){
		n=(mlrVoice *)PlayList.GetHead();
		while (n){
			//COUNT_PROFILE("VOICEMAN_COUNT");
			n->AllocateBuffers();
			n->Exec();
			n=(mlrVoice *)n->GetSucc();
		} 
	}
	else{
		n=(mlrVoice *)PlayList.GetHead();
		while (n){
			n->Pause();
			n=(mlrVoice *)n->GetSucc();
		} 

	}

	Unlock();
}
开发者ID:FreeFalcon,项目名称:freefalcon-central,代码行数:56,代码来源:mlrvoice.cpp

示例6: CanBeStartingCity

int ARegion::CanBeStartingCity( ARegionArray *pRA )
{
	if(type == R_OCEAN) return 0;
    if (!IsCoastal()) return 0;
    if (town && town->pop == 5000) return 0;

    int regs = 0;
    AList inlist;
    AList donelist;

    ARegionPtr * temp = new ARegionPtr;
    temp->ptr = this;
    inlist.Add(temp);

    while(inlist.Num()) {
        ARegionPtr * reg = (ARegionPtr *) inlist.First();
        for (int i=0; i<NDIRS; i++) {
            ARegion * r2 = reg->ptr->neighbors[i];
            if (!r2) continue;
            if (r2->type == R_OCEAN) continue;
            if (GetRegion(&inlist,r2->num)) continue;
            if (GetRegion(&donelist,r2->num)) continue;
            regs++;
            if (regs>20) return 1;
            ARegionPtr * temp = new ARegionPtr;
            temp->ptr = r2;
            inlist.Add(temp);
        }
        inlist.Remove(reg);
        donelist.Add(reg);
    }
    return 0;
}
开发者ID:nedbrek,项目名称:Atlantis,代码行数:33,代码来源:world.cpp

示例7: main

int main()
{
   AList L;
       
   cout << "insert test" << endl;
   for (int i=1; i <= 10; i++)
   {
      L.insert(i);
   }
   
   L.printAList();
   
   cout << "finding a value" << endl;
   L.find(5);   
   L.printAList();
      
   return 0;
}
开发者ID:palmerc,项目名称:lab,代码行数:18,代码来源:main.cpp

示例8: ai

Soldier::Soldier(const AList& lst) :
  ai(0),
  sur(resources->get_sprite("feuerkraft/soldier")),
  sur_light(resources->get_sprite("feuerkraft/soldier-light")),
  acceleration(),
  steering()
{
  pos.x = lst.get_float("x-pos");
  pos.y = lst.get_float("y-pos");
}
开发者ID:BackupTheBerlios,项目名称:feuerkraft-svn,代码行数:10,代码来源:soldier.cpp

示例9:

Marker::Marker(const AList& lst)
{
  passed_time = 0;
  properties->register_float("x-pos", &pos.x);
  properties->register_float("y-pos", &pos.y);

  pos.x = lst.get_float("x-pos");
  pos.y = lst.get_float("y-pos");

  sprite = resources->get_sprite("feuerkraft/marker");
  sprite.set_blend_func(blend_src_alpha, blend_one);
}
开发者ID:BackupTheBerlios,项目名称:feuerkraft-svn,代码行数:12,代码来源:marker.cpp

示例10: Building

CustomBuilding::CustomBuilding(const AList& type, const AList& lst) :
  Building(lst),
  sprite(),
  energie(),
  width(),
  height()
{
  std::string sprite_str = "feuerkraft/nobuilding";
  int         i_energie = 100;
  width   = 2;
  height  = 2;

  type.retrieve_string("sprite",  sprite_str);
  type.retrieve_int   ("energie", i_energie);
  type.retrieve_int   ("width",   width);
  type.retrieve_int   ("height",  height);

  energie.set_max_energie(i_energie);

  sprite = resources->get_sprite(sprite_str);
}
开发者ID:BackupTheBerlios,项目名称:feuerkraft-svn,代码行数:21,代码来源:custom_building.cpp

示例11: building_create_type

int
building_create_type(const char* name, SCM lst)
{
  AList alist;
  
  while(!gh_null_p(lst))
    {
      SCM key   = gh_car(lst);

      if (gh_null_p(gh_cdr(lst)))
        {
          std::cout << "Missing argument to keyword!" << std::endl;
        }

      SCM value = gh_cadr(lst);

      if (gh_boolean_p(value))
        {
          alist.set_bool(Guile::keyword2string(key), gh_scm2bool(value));
        }
      else if (gh_number_p(value))
        {
          alist.set_int(Guile::keyword2string(key), gh_scm2int(value));
        }
      else if (gh_string_p(value))
        {
          alist.set_string(Guile::keyword2string(key), Guile::scm2string(value));
        }
      else
        {
          std::cout << "BuildingCommands: unknown argumnent type" << std::endl;
        }

      lst = gh_cddr(lst);
    }

  return BuildingTypeManager::current()->register_factory(new CustomBuildingFactory(name, alist));
}
开发者ID:BackupTheBerlios,项目名称:feuerkraft-svn,代码行数:38,代码来源:building_commands.cpp

示例12: switch

void
OutputWorldBuilder::print_alist(const AList& alist)
{
  for(AList::const_iterator i = alist.begin(); i != alist.end(); ++i)
    {
      std::cout << "  " << i->first << " -> ";
      switch(i->second.type)
        {
        case AList::AL_INT:
          std::cout << i->second.v_int << std::endl;
          break;
        case AList::AL_FLOAT:
          std::cout << i->second.v_float << std::endl;
          break;
        case AList::AL_BOOL:
          std::cout << i->second.v_bool << std::endl;
          break;
        case AList::AL_STRING:
          std::cout << *i->second.v_string << std::endl;
          break;
        case AList::AL_INTVECTOR2D:
          std::cout << "[" << (*i).second.v_int_vector2d.x
                    << ", " << (*i).second.v_int_vector2d.y
                    << "]"
                    << std::endl;
          break;
          /*case AList::AL_FLOATVECTOR2D:
          std::cout << "[" << (*i).second.v_float_vector2d.x
                    << ", " << (*i).second.v_float_vector2d.y
                    << "]"
                    << std::endl;
                    break;*/
        default:
          std::cout << "<unhandled>" << std::endl;
          break;
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:feuerkraft-svn,代码行数:38,代码来源:output_world_builder.cpp

示例13: TraverseFiles

bool TraverseFiles(const AList& list, bool (*fn)(const AFileNode& file, void *context), void *context)
{
	const AListNode *node = list.First();
	const AFileNode *file;
	bool  success = true;

	while (node && success) {
		if ((file = AFileNode::Cast(node)) != NULL) {
			success = (*fn)(*file, context);
		}

		node = node->Next();
	}

	return success;
}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例14: Building

WallDoor::WallDoor(const AList& lst) :
  Building(lst),
  sprite(),
  map_width(),
  map_height(),
  status(),
  pos()
{
  if (lst.get_string("orientation") == "vertical")
    {
      sprite = resources->get_sprite("feuerkraft/vdoor");
      pos = FloatVector2d(x_pos * 40 + 20, y_pos * 40 + 60);
      map_width = 1;
      map_height = 3;
    }
  else 
    {
      sprite = resources->get_sprite("feuerkraft/hdoor");
      pos = FloatVector2d(x_pos * 40 + 60, y_pos * 40 + 20);
      map_width = 3;
      map_height = 1;
    }
}
开发者ID:BackupTheBerlios,项目名称:feuerkraft-svn,代码行数:23,代码来源:wall_door.cpp

示例15: users

void ADVBConfig::ListUsers(AList& list) const
{
	AHash 	 users(10);
	AList 	 userpatterns;
	AString  filepattern 	   = GetUserPatternsPattern();
	AString  filepattern_parsed = ParseRegex(filepattern);
	AString  _users             = GetConfigItem("users");
	AStdFile fp;
	uint_t   i, n = _users.CountColumns();

	//debug("Reading users from config %s\n", config.GetFilename().str());

	for (i = 0; i < n; i++) {
		AString user = _users.Column(i).Words(0);

		if (!users.Exists(user)) {
			users.Insert(user, 0);
			list.Add(new AString(user));
		}
	}

	if (fp.open(GetPatternsFile())) {
		AString line;

		while (line.ReadLn(fp) >= 0) {
			AString user;
			int p;

			if		((p = line.PosNoCase(" user:=")) >= 0) user = line.Mid(p + 7).Word(0).DeQuotify();
			else if (line.PosNoCase("user:=") == 0)        user = line.Mid(6).Word(0).DeQuotify();

			if (user.Valid() && !users.Exists(user)) {
				users.Insert(user, 0);
				list.Add(new AString(user));
			}
		}

		fp.close();
	}

	::CollectFiles(filepattern.PathPart(), filepattern.FilePart(), 0, userpatterns);

	const AString *file = AString::Cast(userpatterns.First());
	while (file) {
		AString   user;
		ADataList regions;

		if (MatchRegex(*file, filepattern_parsed, regions)) {
			const REGEXREGION *region = (const REGEXREGION *)regions[0];

			if (region) {
				user = file->Mid(region->pos, region->len);
				if (!users.Exists(user)) {
					users.Insert(user, 0);
					list.Add(new AString(user));
				}
			}
		}

		file = file->Next();
	}

	list.Sort(&AString::AlphaCompareCase);
}
开发者ID:,项目名称:,代码行数:64,代码来源:


注:本文中的AList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。