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


C++ clean函数代码示例

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


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

示例1: clean

void QgsProviderRegistry::setLibraryDirectory( QDir const & path )
{
  mLibraryDirectory = path;
  clean();
  init();
}
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:6,代码来源:qgsproviderregistry.cpp

示例2: clean

Histogram::Histogram(unsigned char max, unsigned char min, unsigned char *n)
{
	clean();

	Resize(max, min, n);
}
开发者ID:Karma-Revolutions,项目名称:icub-main,代码行数:6,代码来源:histogram.cpp

示例3: clean

Object::~Object(){
	clean();
}
开发者ID:johnthebrave,项目名称:GameEngine,代码行数:3,代码来源:ObjectFactory.cpp

示例4: main

int
main(int argc, char **argv)
{
	pdf_cmap *cmap;
	fz_stream *fi;
	FILE *fo;
	char name[256];
	char *realname;
	int i, k, m;
	fz_context *ctx;

	if (argc < 3)
	{
		fprintf(stderr, "usage: cmapdump output.c lots of cmap files\n");
		return 1;
	}

	ctx = fz_new_context(NULL, NULL, FZ_STORE_UNLIMITED);
	if (!ctx)
	{
		fprintf(stderr, "cannot initialise context\n");
		return 1;
	}

#undef fopen
	fo = fopen(argv[1], "wb");
	if (!fo)
	{
		fprintf(stderr, "cmapdump: could not open output file '%s'\n", argv[1]);
		return 1;
	}

	fprintf(fo, "/* This is an automatically generated file. Do not edit. */\n");

	for (i = 2; i < argc; i++)
	{
		realname = strrchr(argv[i], '/');
		if (!realname)
			realname = strrchr(argv[i], '\\');
		if (realname)
			realname ++;
		else
			realname = argv[i];

		/* ignore VCS folders (such as .svn) */
		if (*realname == '.')
			continue;

		if (strlen(realname) > (sizeof name - 1))
		{
			fprintf(stderr, "cmapdump: file name too long\n");
			if (fclose(fo))
			{
				fprintf(stderr, "cmapdump: could not close output file '%s'\n", argv[1]);
				return 1;
			}
			return 1;
		}

		strcpy(name, realname);
		clean(name);

		fi = fz_open_file(ctx, argv[i]);
		cmap = pdf_load_cmap(ctx, fi);
		fz_close(fi);

		fprintf(fo, "\n/* %s */\n\n", cmap->cmap_name);

		if (cmap->rlen)
		{
			fprintf(fo, "static const pdf_range cmap_%s_ranges[] = {", name);
			for (k = 0; k < cmap->rlen; k++)
			{
				if (k % 4 == 0)
					fprintf(fo, "\n");
				fprintf(fo, "{%uu,%uu,%uu},", cmap->ranges[k].low, cmap->ranges[k].high, cmap->ranges[k].out);
			}
			fprintf(fo, "\n};\n\n");
		}

		if (cmap->xlen)
		{
			fprintf(fo, "static const pdf_xrange cmap_%s_xranges[] = {", name);
			for (k = 0; k < cmap->xlen; k++)
			{
				if (k % 4 == 0)
					fprintf(fo, "\n");
				fprintf(fo, "{%uu,%uu,%uu},", cmap->xranges[k].low, cmap->xranges[k].high, cmap->xranges[k].out);
			}
			fprintf(fo, "\n};\n\n");
		}

		if (cmap->mlen > 0)
		{
			fprintf(fo, "static const pdf_mrange cmap_%s_mranges[] = {", name);
			for (k = 0; k < cmap->mlen; k++)
			{
				fprintf(fo, "\n{%uu,%uu,{", cmap->mranges[k].low, cmap->mranges[k].len);
				for (m = 0; m < PDF_MRANGE_CAP; ++m)
					fprintf(fo, "%uu,", cmap->mranges[k].out[m]);
//.........这里部分代码省略.........
开发者ID:EvoGroupTN,项目名称:mupdf,代码行数:101,代码来源:cmapdump.c

示例5: on_signal

void on_signal(int sig) {
    debug("Caught signal %d.\n", sig);
    clean();
}
开发者ID:czaber,项目名称:ogwm,代码行数:4,代码来源:main.c

示例6: clean

Scope::~Scope() {
  clean();
}
开发者ID:Josok,项目名称:EasyDarwin,代码行数:3,代码来源:GroupEId.cpp

示例7: in


//.........这里部分代码省略.........
		{
			char tmp[200];
			
			//Read the name of the material to tmp
			sscanf(coord[i]->c_str(), "usemtl %s", tmp);  

			//Go through all of the materials
			for (int i = 0; i<materials.size(); i++)     
			{
				//And compare the tmp with the name of the material
				if (strcmp(materials[i]->name.c_str(), tmp) == 0)   
				{
					//If it's equal then set the current material to that
					curmat = i;       
					break;
				}
			}
		}
		//Material library, a file, which contain all of the materials
		else if ((*coord[i])[0] == 'm' && (*coord[i])[1] == 't' && (*coord[i])[2] == 'l' && (*coord[i])[3] == 'l')      
		{
			char filen[200];
			
			//Read the fileName
			sscanf(coord[i]->c_str(), "mtllib %s", filen);    
			
			//Open the file
			ifstream mtlin(filen);     
			
			//If not opened, show a error message, clean all memory, then return with -1
			if (!mtlin.is_open())    
			{
				cout << "connot open the material file" << endl;
				clean();
				return -1;
			}
			
			//We use materials
			ismaterial = true;        
			
			//Contain the line of the file
			vector<string> tmp;
			
			char c[200];
			
			while (!mtlin.eof())
			{
				//Read all lines to tmp
				mtlin.getline(c, 200);   
				tmp.push_back(c);
			}
			
			//Name of the material
			char name[200]; 
			
			//fileName of the texture
			char fileName[200];     
			
			//Colors, shininess, etc
			float amb[3], dif[3], spec[3], alpha, ns, ni;        
			
			int illum;
			unsigned int texture;
			
			//Do we already have a material read in to these variables?
			bool ismat = false;       
开发者ID:Robbiep003,项目名称:AGEC,代码行数:67,代码来源:ObjLoader.cpp

示例8: clean

ActorManager::~ActorManager()
{
 clean();
}
开发者ID:nuvie,项目名称:nuvie,代码行数:4,代码来源:ActorManager.cpp

示例9: clean

void BonusManager::init() {
	clean();
	instance = new BonusManager();
}
开发者ID:Wookesh,项目名称:SteamNations,代码行数:4,代码来源:Bonuses.cpp

示例10: clean

void vpKltOpencv::reset()
{
    clean();

}
开发者ID:tswang,项目名称:visp,代码行数:5,代码来源:vpKltOpencv.cpp

示例11: clean

	/** modify **/
	bool Url::parse(String* url){
		// clean
		clean();
		
		// check
		if(!url){
			return false;
		}

		// prepare sz
		const char* sz =url->c_str();
		// puts(sz);

		// protocol
		const char* cursor =strstr(sz, "://");
		int64_t pos =(cursor ? (cursor-sz) : -1);
		if(pos == 0){
			ERROR("fail to call %s, len(protocol) can't be 0");
			return false;
		}
		else if(pos > 0){
			ASSIGN_POINTER(m_protocol, String::New(sz, pos));
			sz =cursor + 3;
		}

		// auth
		cursor =strchr(sz, '@');
		pos =(cursor ? (cursor-sz) : -1);
		if(pos == 0){
			CLEAN_POINTER(m_protocol);
			ERROR("fail to call %s, len(auth) can't be 0");
			return false;
		}
		else if(pos > 0){
			ASSIGN_POINTER(m_auth, String::New(sz, pos));
			sz =cursor + 1;
		}

		// host
		const char* szbeg =sz;
		while(const char ch =*sz){
			if(ch=='/' || ch=='?' || ch=='#'){
				break;
			}
			++sz;
		}
		if(sz > szbeg){
			ASSIGN_POINTER(m_host, String::New(szbeg, sz-szbeg));
		}

		// path
		if(*sz == '/'){
			const char* szbeg =sz++;
			while(const char ch =*sz){
				if(ch=='?' || ch=='#'){
					break;
				}
				++sz;
			}
			ASSIGN_POINTER(m_path, String::New(szbeg, sz-szbeg));
		}

		// query
		if(*sz == '?'){
			const char* szbeg =++sz;
			while(const char ch =*sz){
				if(ch == '#'){
					break;
				}
				++sz;
			}
			if(sz > szbeg){
				ASSIGN_POINTER(m_query_string, String::New(szbeg, sz-szbeg));
				ASSIGN_POINTER(m_query, SafeNew<Hash>());
				if(!ParseQuery(m_query_string, m_query)){
					clean();
					return false;
				}
			}
			else{
				ASSIGN_POINTER(m_query_string, String::New(szbeg, sz-szbeg));
			}
		}

		// fragment
		if(*sz == '#'){
			ASSIGN_POINTER(m_fragment, String::New(sz+1));
		}

		// url
		ASSIGN_POINTER(m_url, url);

		return true;
	}
开发者ID:AllenWangxiao,项目名称:winner,代码行数:95,代码来源:Url.cpp

示例12: Bellman_Ford


//.........这里部分代码省略.........
      }
      //^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ //


      //waking all the sending threads.
      //^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ //
//      if(sent==routing_table->directNeighbors){
//
////          printf("Bellman_Ford():signal sent to convar2\n");
// //         sent=-1;
////          for(i=0;i<routing_table->directNeighbors;i++){
////              pthread_cond_signal(&convar2);
////          }
////          pthread_mutex_unlock(&mutex);
////          pthread_mutex_lock(&mutex);
//      }
      //^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ //


      //^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ //
      //in the case which all of the other nodes sent 0 then finishing the algorithm
      if(zeroReceived>=routing_table->directNeighbors){
          received=-1;
          sent=-1;
    //      printf("Bellman_Ford():signal sent to convar1+2+3\n");
          for(i=0;i<routing_table->directNeighbors;i++){
              pthread_cond_signal(&convar1);
          }
//          for(i=0;i<routing_table->directNeighbors;i++){
//              pthread_cond_signal(&convar2);
//          }

          pthread_cond_signal(&convar3);
          pthread_mutex_unlock(&mutex);

          pthread_mutex_lock(&mutex);
      //    printf("Bellman_Ford():done=1\n");

          break;
      }
      //^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ //


      //^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ //
      //in the case which all neighbors's DV received ,waking the recomputing thread.
      if(received>=routing_table->directNeighbors&& sent>=routing_table->directNeighbors){

         // printf("Bellman_Ford():signal sent to convar3\n");
          received=-1;
          sent=-1;
          pthread_cond_signal(&convar3);
          pthread_mutex_unlock(&mutex);
          pthread_mutex_lock(&mutex);
      }
      //^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ //


      //^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ //
      //reset all the global variables
      if(doneComputing==1){
          received=0;
          sent=0;
          sentOnce=0;
          doneComputing=0;
      }


      pthread_mutex_unlock(&mutex);
  }
 // printf("Bellman_Ford():outside main loop\n");

  pthread_mutex_unlock(&mutex);









  //joining all the threads-this means the main thread will wait until all of the threads will exist.
  pthread_join(recompute, NULL);
  for (i=0; i<routing_table->directNeighbors*2; i++) {
      pthread_join(threads[i], NULL);
  }



 // printTable();
 // printf("printing via\n\n\n");
//  for(i=0;i<routing_table->numOfNodes;i++)
//    printf("%d\t",routing_table->via[i]);
//  printf("\n\n\n");
  printFinalResualt();//printing resualt
//  printf("\n\n\n");
  clean();//cleaning all the dynamically allocated memory,

  exit(0);
}
开发者ID:gabaynati,项目名称:BFS-routing-implementation,代码行数:101,代码来源:main.c

示例13: add_refentity_name

CubitStatus RefEntityName::add_refentity_name(RefEntity *entity,
                                              DLIList<CubitString> &names,
                                              bool update_attribs, 
                                              bool check_name_validity)
{
  names.reset();
  //int num_new_names = names.size();

  DLIList<CubitString> new_names;
  
  for (int i=0; i<names.size(); i++)
  {
    CubitString name = names[i];
    CubitString in_name = name;
    CubitBoolean warn_name_change = CUBIT_FALSE;
    
      // first, clean the name
    if (check_name_validity)
    {
      if (clean(name))
      {
        // assign original name anyway, then
        // continue on and assign modified name.
        add_refentity_name(entity, in_name, false, false);
        warn_name_change = CUBIT_TRUE;
      }
    }
      // now, check for valid name
    CubitBoolean name_valid = CUBIT_FALSE;
    
    if (name == "")
    {
        // blank name entered - do nothing
    }
    
    else if (nameEntityList.move_to(name) &&
             nameEntityList.get()->value() == entity)
    {
        // Tried to assign same name to entity
      if ( DEBUG_FLAG(92) ) 
      {
          // check to see if it's the same as this entity's default name,
          // if so, it probably came in on an attribute, and we don't need
          // to hear about it; otherwise, write the warning
        CubitString def_name;
        entity->generate_default_name(def_name);
        if (name != def_name)
          PRINT_INFO("Entity name '%s' already assigned to %s %d\n",
                     name.c_str(), 
                     entity->class_name(), entity->id());
      }
    }
    else if (nameEntityList.move_to(name) &&
             nameEntityList.get()->value() != entity)
    {
        // Tried to assign existing name to another entity
      PRINT_DEBUG_92( "Entity name '%s' for %s %d is already used by %s %d\n",
                  name.c_str(), entity->class_name(), entity->id(),
                  nameEntityList.get()->value()->class_name(),
                  nameEntityList.get()->value()->id());
      
        // either we fix it and keep it, or we don't and get rid of it
      name_valid = CUBIT_FALSE;
      if (get_fix_duplicate_names())
      {
        if (generate_unique_name(name))
        {
          PRINT_DEBUG_92( "\t%s %d name changed to '%s'\n",
                          entity->class_name(), entity->id(), name.c_str());
          if(warn_name_change)
          {
            PRINT_WARNING("Entity name '%s' can't be used in commands.\n"
                 "         Additional name '%s' assigned.\n",
              in_name.c_str(), name.c_str());
          }
          
          name_valid = CUBIT_TRUE;
        }
      }
    }
    else
    {
      if(warn_name_change)
      {
        PRINT_WARNING("Entity name '%s' can't be used in commands.\n"
          "         Additional name '%s' assigned.\n",
          in_name.c_str(), name.c_str());
      }
      
        // else the name must be valid
      name_valid = CUBIT_TRUE;
    }
    
    if (name_valid == CUBIT_TRUE)
    {
        // name is valid
      if (name != in_name)
          // name was changed; change in name list too
        names[i] = name;

//.........这里部分代码省略.........
开发者ID:chrismullins,项目名称:cgma,代码行数:101,代码来源:RefEntityName.cpp

示例14: init

 void init() {
     m_exportFile = "exportfile";
     m_manager = new QLandmarkManager;
     m_handler = new QLandmarkFileHandlerLmx;
     clean();
 }
开发者ID:ionionica,项目名称:qt-mobility,代码行数:6,代码来源:tst_qlandmarkfilehandler_lmx.cpp

示例15: clean

void Map::terminate()
{
    clean();
}
开发者ID:EvilSmock,项目名称:otclient,代码行数:4,代码来源:map.cpp


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