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


C++ set_flags函数代码示例

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


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

示例1: create_key_pair

// There is no scenario requiring a public key, we support it for completeness.
bool create_key_pair(encrypted_private& out_private,
    encrypted_public& out_public, ec_compressed& out_point,
    const encrypted_token& token, const ek_seed& seed, uint8_t version,
    bool compressed)
{
    const parse_encrypted_token parse(token);
    if (!parse.valid())
        return false;

    const auto point = splice(parse.sign(), parse.data());
    auto point_copy = point;
    const auto factor = bitcoin_hash(seed);
    if (!ec_multiply(point_copy, factor))
        return false;

    ek_salt salt;
    if (!address_salt(salt, point_copy, version, compressed))
        return false;

    const auto salt_entropy = splice(salt, parse.entropy());
    const auto derived = split(scrypt_pair(point, salt_entropy));
    const auto flags = set_flags(compressed, parse.lot_sequence(), true);

    if (!create_public_key(out_public, flags, salt, parse.entropy(),
        derived.left, derived.right, factor, version))
        return false;

    create_private_key(out_private, flags, salt, parse.entropy(), derived.left,
        derived.right, seed, version);

    out_point = point_copy;
    return true;
}
开发者ID:GeopaymeEE,项目名称:libbitcoin,代码行数:34,代码来源:encrypted_keys.cpp

示例2: set_side

bool CubeMap::_set(const StringName& p_name, const Variant& p_value) {

	if (p_name=="side/left") {
		set_side(SIDE_LEFT,p_value);
	} else if (p_name=="side/right") {
		set_side(SIDE_RIGHT,p_value);
	} else if (p_name=="side/bottom") {
		set_side(SIDE_BOTTOM,p_value);
	} else if (p_name=="side/top") {
		set_side(SIDE_TOP,p_value);
	} else if (p_name=="side/front") {
		set_side(SIDE_FRONT,p_value);
	} else if (p_name=="side/back") {
		set_side(SIDE_BACK,p_value);
	} else if (p_name=="flags") {
		set_flags(p_value);
	} else if (p_name=="storage") {
		storage=Storage(p_value.operator int());
	} else if (p_name=="lossy_quality") {
		lossy_storage_quality=p_value;
	} else
		return false;

	return true;

}
开发者ID:AutonomicStudios,项目名称:godot,代码行数:26,代码来源:texture.cpp

示例3: set_flags

void
perfroll::on_realize()
{
    // we need to do the default realize
    Gtk::DrawingArea::on_realize();

    set_flags( Gtk::CAN_FOCUS );

    // Now we can allocate any additional resources we need
    m_window = get_window();
    m_gc = Gdk::GC::create( m_window );
    m_window->clear();

    update_sizes();

    m_hadjust->signal_value_changed().connect( mem_fun( *this, &perfroll::change_horz ));
    m_vadjust->signal_value_changed().connect( mem_fun( *this, &perfroll::change_vert ));

    /*
        This creation of m_background needs to be set to the max width for proper drawing of zoomed
        measures or they will get truncated with high beats per measure and low beat width. Since this
        is a constant size, it cannot be adjusted later for zoom. The constant c_perfroll_background_x
        is set to the max amount by default for use here. The drawing functions fill_background_pixmap()
        and draw_background_on() which use c_perfroll_background_x also, could be adjusted by zoom with
        a substituted variable. Not sure if there is any benefit to doing the adjustment...
        Perhaps a small benefit in speed? Maybe FIXME if really, really bored...
    */

    m_background = Gdk::Pixmap::create( m_window,
                                        c_perfroll_background_x,
                                        c_names_y, -1 );

    /* and fill the background ( dotted lines n' such ) */
    fill_background_pixmap();
}
开发者ID:Stazed,项目名称:seq32,代码行数:35,代码来源:perfroll.cpp

示例4: gen_faq_doc

void 
gen_faq_doc( const char *source_dir, const char *dest_dir, ASDocType doc_type )
{
	ASXMLInterpreterState state;
	char *faq_dir = NULL ;
	ASFlagType doc_class_mask = DOC_CLASS_None	;
	struct direntry  **list = NULL;
	int list_len, i ;

	faq_dir = make_file_name( source_dir, "FAQ" );

	if( !start_doc_file( dest_dir, "afterstep_faq", NULL, doc_type, 
						 "afterstep_faq", 
						 "AfterStep FAQ",
						 "This document is an ever growing set of questions, statements, ideas and complaints about AfterStep version 2.0", 
						 &state, doc_class_mask, DocClass_FAQ ) )	 
		return ;
	
	/* BODY *************************************************************************/
	set_flags( state.flags, ASXMLI_OrderSections );
	list_len = my_scandir ((char*)faq_dir, &list, ignore_dots, NULL);
	for (i = 0; i < list_len; i++)
	{	
		if ( !S_ISDIR (list[i]->d_mode) )
			convert_xml_file( faq_dir, list[i]->d_name, &state );
		free(list[i]);
	}
	if( list ) 
		free( list );   
	
	/* FOOTER ***********************************************************************/
	end_doc_file( &state );	 	
	
	free( faq_dir );
}
开发者ID:Vaevictusnet,项目名称:afterstep-devel,代码行数:35,代码来源:ASDocGen.c

示例5: encrypt

bool encrypt(encrypted_private& out_private, const ec_secret& secret,
    const std::string& passphrase, uint8_t version, bool compressed)
{
    ek_salt salt;
    if (!address_salt(salt, secret, version, compressed))
        return false;

    const auto derived = split(scrypt_private(normal(passphrase), salt));
    const auto prefix = parse_encrypted_private::prefix_factory(version,
        false);

    auto encrypted1 = xor_data<half>(secret, derived.left);
    aes256_encrypt(derived.right, encrypted1);

    auto encrypted2 = xor_data<half>(secret, derived.left, half);
    aes256_encrypt(derived.right, encrypted2);

    return build_checked_array(out_private,
    {
        prefix,
        set_flags(compressed),
        salt,
        encrypted1,
        encrypted2
    });
}
开发者ID:GeopaymeEE,项目名称:libbitcoin,代码行数:26,代码来源:encrypted_keys.cpp

示例6: setclassname

// ---------------------------------------------------------------------------
// Constructeur
// ------------
bXMapTopoCheck	::bXMapTopoCheck(bGenericXMLBaseElement* elt, bGenericMacMapApp* gapp, CFBundleRef bndl)
                :bStdXMap(elt,gapp,bndl)
                ,_types(sizeof(bGenericType*)){
    setclassname("topocheck");
    set_flags(kXMapNeedEvents);
    _prm.types=&_types;
}
开发者ID:CarteBlancheConseil,项目名称:Instances,代码行数:10,代码来源:bXMapTopoCheck.cpp

示例7: setttymode

static void
setttymode(int raw)
{
	int off = 0;

	(void)tcflush(STDIN_FILENO, TCIOFLUSH);	/* clear out the crap */
	ioctl(STDIN_FILENO, FIONBIO, &off);	/* turn off non-blocking mode */
	ioctl(STDIN_FILENO, FIOASYNC, &off);	/* ditto for async mode */

	if (IS)
		cfsetispeed(&tmode, speed(IS));
	else if (SP)
		cfsetispeed(&tmode, speed(SP));
	if (OS)
		cfsetospeed(&tmode, speed(OS));
	else if (SP)
		cfsetospeed(&tmode, speed(SP));
	set_flags(0);
	setchars();
	if (raw)
		cfmakeraw(&tmode);
	if (tcsetattr(STDIN_FILENO, TCSANOW, &tmode) < 0) {
		syslog(LOG_ERR, "tcsetattr %s: %m", ttyn);
		exit(1);
	}
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:26,代码来源:main.c

示例8: check_args

/**Looks at the different args passed into the program
 *
 *This method looks at all other arguments passed into the program
 *besides the first one (program name) to ascertain
 *which flags are present. It checks for the '-' char to indicate
 *a flag, as well as for a directory name. 
 *@param[in] argc the total number of args
 *@param[in] argv the list of command line args passed to main
 */
int check_args(int argc, char** argv)
{
        paths = malloc(2);
        paths[0] = ".";
        int num_paths = 0;
        int size = 0;
        //for each command line arg
        for(int i = 1; i < argc; i++)
        {
                char* arg = argv[i];
               
                //if flag
                if(arg[0] == '-')
                {
                       set_flags(arg);
                }
                else
                {
                        size += strlen(arg) +1;
                        paths = realloc(paths, size); 
                        if(path != NULL) paths[num_paths++] = arg;
                }
        }
        return num_paths == 0 ? 1 : num_paths;        
}
开发者ID:keananf,项目名称:ls-command,代码行数:34,代码来源:ls.c

示例9: twistbc

extern void twistbc(double *theta,double sign)
{
   int ibc,i,mu;
   su3_dble *u;
   int Lmu[4];

   if( (fabs(*(theta+0))<1e-10) && (fabs(*(theta+1))<1e-10) && 
       (fabs(*(theta+2))<1e-10) && (fabs(*(theta+3))<1e-10) )
     return ;

   message("Twisting the boundaries\n");

   ibc=query_flags(BCD_FLIPPED);
   if (ibc==1)
     flipbcd();

   Lmu[0]=NPROC0*L0;
   Lmu[1]=NPROC1*L1;
   Lmu[2]=NPROC2*L2;
   Lmu[3]=NPROC3*L3;
   u=pud[VOLUME/2][0];
   for (i=0;i<VOLUME/2;i++)
   {
      for(mu=0;mu<4;mu++){
      su3_appl_twist(u+8*i+2*mu  ,(double)(sign*(*(theta+mu))/Lmu[mu]));
      su3_appl_twist(u+8*i+2*mu+1,(double)(sign*(*(theta+mu))/Lmu[mu]));
      }
   }
   assign_ud2u();
   set_flags(NEW_UD);

   if (ibc==1)
     flipbcd();
}
开发者ID:chelmes,项目名称:Contraction,代码行数:34,代码来源:twistbc.c

示例10: get_default_colormap

DimRegionChooser::DimRegionChooser()
{
    // get_window() would return 0 because the Gdk::Window has not yet been realized
    // So we can only allocate the colors here - the rest will happen in on_realize().
    Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap();

    black = Gdk::Color("black");
    white = Gdk::Color("white");
    red = Gdk::Color("#8070ff");
    blue = Gdk::Color("blue");
    green = Gdk::Color("green");

    colormap->alloc_color(black);
    colormap->alloc_color(white);
    colormap->alloc_color(red);
    colormap->alloc_color(blue);
    colormap->alloc_color(green);
    instrument = 0;
    region = 0;
    dimregno = -1;
    focus_line = 0;
    resize.active = false;
    cursor_is_resize = false;
    h = 20;
    w = 800;
    set_flags(Gtk::CAN_FOCUS);
    add_events(Gdk::BUTTON_PRESS_MASK | Gdk::POINTER_MOTION_MASK |
               Gdk::POINTER_MOTION_HINT_MASK);

    for (int i = 0 ; i < 256 ; i++) dimvalue[i] = 0;
}
开发者ID:svn2github,项目名称:linuxsampler,代码行数:31,代码来源:dimregionchooser.cpp

示例11: restore_internal_state

static void
restore_internal_state (struct terminal_state_recording * s,
       struct terminal_state_recording * es)
{
  /* When we recorded the internal state, we had a recording of the
     external state.  But since we've stopped Scheme and restarted it,
     we may no longer have a current recording of the external state.
     If we don't, then we can't restore the internal state.

     The usual reason that we don't have a recording is that Scheme is
     in the background.  In that case it would be nice to preserve the
     previous internal state until we go back to the foreground.  But
     doing that transparently would also require tracking all
     attempted state changes in the recording, which is a pain.  So if
     we can't restore the internal state, we just thrown it away. */
  if (s -> recorded_p)
    {
      if (es -> recorded_p)
	{
	  set_terminal_state ((s -> fd), (& (s -> state)));
	  set_flags ((s -> fd), (& (s -> flags)));
	}
      (s -> recorded_p) = 0;
    }
}
开发者ID:tali713,项目名称:mit-scheme,代码行数:25,代码来源:uxctty.c

示例12: main

int main( int argc, char** argv )
{
  struct cell *cells_local[N];
  int arg;
  size_t i;
  struct pool *p      = allocate_pool();
  struct cell **cells = static_roots ? cells_static : cells_local;

  assert(argc == 2);
  assert(argv[1]);
  assert(strlen(argv[1]) == 1);
  assert(argv[1][0] >= '0' && argv[1][0] <= '5');
  arg = atoi( argv[1] );
  set_flags( arg );

  memset(cells_static, 0, sizeof(cells_static));
  memset(cells_local,  0, sizeof(cells_local));

  for (i = 0; i < N; ++i) {
    cells[i] = allocate_from_pool(p, sizeof(struct cell));  
  }

  if (trim_pool)
  VALGRIND_MEMPOOL_TRIM(p, 
			p->buf+(10 * sizeof(struct cell)), 
			20 * sizeof(struct cell) + 2);

  if (destroy_pool)
  VALGRIND_DESTROY_MEMPOOL(p);

  return 0;
}
开发者ID:MShudrak,项目名称:flayer,代码行数:32,代码来源:leak-pool.c

示例13: main

/**
 *
 Creates a hashtable, and inserts words into it.
 The table is then printed before we free the memory allocated to it.

 Note: The tablesize of the hashtable is determined by the first command line
 argument if there is one, with a default table tablesize of 113.
 The number of statistical snapshots to print is determined by the second
 command line argument if there is one, with a default number of 10.

 tablesize = the maximum number of positions in the hash table.
 word      = the string to be inserted into the hash table.
 ht        = the hash table using eith double hashing or linear probing.
 snapshots = the number of statistical snapshots to be used.

 @param argc the number of command-line arguments.
 @param argv an array of strings containing the command-line arguments.

 @return EXIT_SUCCESS if the program is successful.

*/
int main(int argc, char **argv) {
  time_t start,end;
  bool_t entire_table = FALSE, double_hashing = FALSE, print_stats = FALSE,
    do_spell_check = FALSE;
  int tablesize = 113, snapshots = 10;
  char word[256];
  char *filename;
  htable ht;

  set_flags(argc, argv, &do_spell_check, &filename, &double_hashing, &entire_table,
	    &print_stats, &snapshots, &tablesize);

  ht = htable_new(tablesize, (double_hashing) ? DOUBLE_H : LINEAR_P);
  start = clock();
  while (getword(word, sizeof word, stdin) != EOF) {
    htable_insert(ht, word);
  }
  end = clock();
  if(do_spell_check) {
    spell_check(ht,filename,(end-start)/(double)CLOCKS_PER_SEC);
  }
  if (entire_table) {
    htable_print_entire_table(ht, stderr);
  }
  if (print_stats) {
    htable_print_stats(ht, stdout, snapshots);
  } else if (!do_spell_check){ /* print words and frequencies */
    htable_print(ht, stdout);
  }
  htable_delete(ht);

  return EXIT_SUCCESS;
}
开发者ID:lchish,项目名称:cosc,代码行数:54,代码来源:htable-main.c

示例14: create_from_image

bool ImageTexture::_set(const StringName& p_name, const Variant& p_value) {

	if (p_name=="image" && p_value.get_type()==Variant::IMAGE)
		create_from_image( p_value,flags );
	else if (p_name=="flags")
		if (w*h==0)
			flags=p_value;
		else
			set_flags(p_value);
	else if (p_name=="size") {
		Size2 s = p_value;
		w=s.width;
		h=s.height;
		VisualServer::get_singleton()->texture_set_size_override(texture,w,h);
	} else if (p_name=="storage") {
		storage=Storage(p_value.operator int());
	} else if (p_name=="lossy_quality") {
		lossy_storage_quality=p_value;
	} else if (p_name=="_data") {
		_set_data(p_value);
	} else
		return false;

	return true;

}
开发者ID:AutonomicStudios,项目名称:godot,代码行数:26,代码来源:texture.cpp

示例15: picture2asimage

ASImage      *
picture2asimage(ASVisual *asv, Pixmap rgb, Pixmap a , int x, int y, unsigned int width, unsigned int height, unsigned long plane_mask, Bool keep_cache, unsigned int compression)
{
#ifndef X_DISPLAY_MISSING
	XImage       *xim = ASGetXImage (asv, rgb, x, y, width, height, plane_mask);
	XImage       *alpha_xim = (a==None)?NULL:ASGetXImage (asv, a, x, y, width, height, 0xFFFFFFFF);
	ASImage      *im = NULL;

	if (xim)
	{
		im = picture_ximage2asimage (asv, xim, alpha_xim, compression);
		if( keep_cache )
		{
			im->alt.ximage = xim ;
			if( alpha_xim )
			{
				im->alt.mask_ximage = alpha_xim ;
				if( alpha_xim->depth == 8 )
					set_flags( im->flags, ASIM_XIMAGE_8BIT_MASK );
			}
		}else
		{
			XDestroyImage (xim);
			if( alpha_xim )
				XDestroyImage (alpha_xim);
		}
	}
	return im;
#else
    return NULL ;
#endif
}
开发者ID:0x0all,项目名称:ROOT,代码行数:32,代码来源:ximage.c


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