本文整理汇总了C++中set_str函数的典型用法代码示例。如果您正苦于以下问题:C++ set_str函数的具体用法?C++ set_str怎么用?C++ set_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_str函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: print_mode_name
void print_mode_name(int x, int y, Object * obj, char *mode)
{
char buf[64];
sprintf(buf, "[%s]", mode);
int len = strlen(buf);
int pad = 16 - len;
if (pad < 0)
buf[15] = 0;
set_str((CHAR_INFO *) screen_buffer, buf, x, y, 0, 15);
}
示例2: node_requestid
int node_requestid(
pbs_attribute *new_attr, /*derive state into this pbs_attribute*/
void *pnode, /*pointer to a pbsnode struct */
int actmode) /*action mode; "NEW" or "ALTER" */
{
int rc = 0;
struct pbsnode *np = (struct pbsnode*)pnode; /*because of def of at_action args*/
pbs_attribute temp;
switch (actmode)
{
case ATR_ACTION_NEW:
if(np->nd_requestid->size() != 0)
{
temp.at_val.at_str = (char *)np->nd_requestid->c_str();
temp.at_flags = ATR_VFLAG_SET;
temp.at_type = ATR_TYPE_STR;
rc = set_str(new_attr, &temp, SET);
}
else
{
new_attr->at_val.at_str = NULL;
new_attr->at_flags = 0;
new_attr->at_type = ATR_TYPE_STR;
}
break;
case ATR_ACTION_ALTER:
if(new_attr->at_val.at_str != NULL)
{
*np->nd_requestid = new_attr->at_val.at_str;
}
else
{
np->nd_requestid->clear();
}
break;
default:
rc = PBSE_INTERNAL;
break;
}
return(rc);
}
示例3: isWide
void ICQClient::setAIMInfo(ICQUserData *data)
{
if (getState() != Connected)
return;
bool bWide = isWide(data->FirstName.ptr) ||
isWide(data->LastName.ptr) ||
isWide(data->MiddleName.ptr) ||
isWide(data->Maiden.ptr) ||
isWide(data->Nick.ptr) ||
isWide(data->Zip.ptr) ||
isWide(data->Address.ptr) ||
isWide(data->City.ptr);
string country;
for (const ext_info *e = getCountryCodes(); e->szName; e++){
if (e->nCode == data->Country.value){
country = e->szName;
break;
}
}
snac(ICQ_SNACxFAM_LOCATION, ICQ_SNACxLOC_SETxDIRxINFO);
string encoding = bWide ? "unicode-2-0" : "us-ascii";
m_socket->writeBuffer.tlv(0x1C, encoding.c_str());
m_socket->writeBuffer.tlv(0x0A, (unsigned short)0x01);
encodeString(data->FirstName.ptr, 0x01, bWide);
encodeString(data->LastName.ptr, 0x02, bWide);
encodeString(data->MiddleName.ptr, 0x03, bWide);
encodeString(data->Maiden.ptr, 0x04, bWide);
encodeString(country.c_str(), 0x06, bWide);
encodeString(data->Address.ptr, 0x07, bWide);
encodeString(data->City.ptr, 0x08, bWide);
encodeString(data->Nick.ptr, 0x0C, bWide);
encodeString(data->Zip.ptr, 0x0D, bWide);
encodeString(data->State.ptr, 0x21, bWide);
sendPacket(false);
ICQUserData *ownerData = &this->data.owner;
set_str(&ownerData->FirstName.ptr, data->FirstName.ptr);
set_str(&ownerData->LastName.ptr, data->LastName.ptr);
set_str(&ownerData->MiddleName.ptr, data->MiddleName.ptr);
set_str(&ownerData->Maiden.ptr, data->Maiden.ptr);
set_str(&ownerData->Address.ptr, data->Address.ptr);
set_str(&ownerData->City.ptr, data->City.ptr);
set_str(&ownerData->Nick.ptr, data->Nick.ptr);
set_str(&ownerData->Zip.ptr, data->Zip.ptr);
set_str(&ownerData->State.ptr, data->State.ptr);
ownerData->Country.value = data->Country.value;
}
示例4: draw_examine
int
draw_examine(int display_x, int display_y, World * w, int x, int y,
Object * exclude)
{
Object *obj = obj_at(w, x, y, exclude);
if (obj == 0)
return 0;
set_str((CHAR_INFO *) screen_buffer, obj->type, display_x, display_y, 0,
obj->shape.fg_color);
return 1;
}
示例5: output_control
static void output_control(void)
{
int i;
gpio_line_config(GPIO_SCL, IXP4XX_GPIO_OUT);
gpio_line_config(GPIO_SDA, IXP4XX_GPIO_OUT);
for (i = 0; i < 8; i++) {
set_scl(0);
set_sda(control_value & (0x80 >> i)); /* MSB first */
set_scl(1); /* active edge */
}
set_str(1);
set_str(0);
set_scl(0);
set_sda(1); /* Be ready for START */
set_scl(1);
}
示例6: output_control
static void output_control(void)
{
int i;
gpio_line_config(GPIO_SCL, IXP4XX_GPIO_OUT);
gpio_line_config(GPIO_SDA, IXP4XX_GPIO_OUT);
for (i = 0; i < 8; i++) {
set_scl(0);
set_sda(control_value & (0x80 >> i)); /* */
set_scl(1); /* */
}
set_str(1);
set_str(0);
set_scl(0);
set_sda(1); /* */
set_scl(1);
}
示例7: set_str
void FileConfig::apply(void *_data)
{
CoreUserData *data = (CoreUserData*)_data;
QString def;
if (edtPath->text().isEmpty()) {
def = "Incoming Files";
} else {
def = edtPath->text();
}
set_str(&data->IncomingPath.ptr, QFile::encodeName(def));
edtPath->setText(QFile::decodeName(data->IncomingPath.ptr ? user_file(data->IncomingPath.ptr).c_str() : ""));
data->AcceptMode.value = 0;
if (btnAccept->isOn()){
data->AcceptMode.value = 1;
data->OverwriteFiles.bValue = chkOverwrite->isChecked();
}
if (btnDecline->isOn()){
data->AcceptMode.value = 2;
set_str(&data->DeclineMessage.ptr, edtDecline->text().utf8());
}
}
示例8: main
main()
{
init_params();
set_int("SCALE", "7");
set_flg("VERBOSE");
set_str("DISTRIBUTIONS", "'some file name'");
print_params();
set_int("s" , "8");
clr_flg("VERBOSE");
printf("DIST is %s\n", get_str("DISTRIBUTIONS"));
print_params();
usage(NULL, NULL);
}
示例9: create
void create() {
object ob;
::create();
set_gender( random(2)+1 );
/* OBJEDIT { */
set_spd( 12 );
set_con( 13 );
set_str( 14 );
set_dex( 15 );
set_wil( 10 );
set_cha( 3 );
set_int( 4 );
set_emp( 3 );
set_distant( "a wolf" );
set_specific( "the wolf" );
set_look( "~Name ~verbhas gray fur, penetrating yellow eyes, and a generally surly disposition. ~Pron is $(HP)." );
set_plural( "wolves" );
set_name( "wolf" );
set_type( "wolf" );
set_droppable( 1 );
set_weight( 45000 );
/* } OBJEDIT */
set_living_name( name );
set_food(query_food_capacity()/2);
set_drink(query_drink_capacity()/2);
add_form("animal");
set_form("animal", 1);
remove_form("brawl");
set_race("canine");
set_wc((["piercing":6]));
set_wimpy(30);
/*
set_env_var( "skin_type", "/monsters/skin/wolf_pelt" );
set_env_var( "meat_type", "/monsters/meat/wolf" );
*/
set_product_aspect( C_WOLF );
add_product( C_MEAT, 3, 40 );
add_product( C_PELT, 7, 20 );
// add_product( C_TOOTH, 4, 40 );
clone_object("/ai/carnivore")->move(this_object());
ob = clone_object("/ai/aggro");
ob->set_aggro_level(10);
ob->move(this_object());
}
示例10: parse_bam_list
void parse_bam_list( parameters** params)
{
FILE* bam_list;
char next_path[1024];
int i;
bam_list = safe_fopen( ( *params)->bam_list_path, "r");
i = 0;
while( fscanf( bam_list, "%s\n", next_path) == 1)
{
set_str( &( ( *params)->bam_file_list)[i], next_path);
i = i + 1;
}
fclose( bam_list);
}
示例11: set_str
void JabberHomeInfo::apply(Client *client, void *_data)
{
if (client != m_client)
return;
JabberUserData *data = (JabberUserData*)_data;
set_str(&data->Street.ptr, edtStreet->text().toUtf8());
set_str(&data->ExtAddr.ptr, edtExt->text().toUtf8());
set_str(&data->City.ptr, edtCity->text().toUtf8());
set_str(&data->Region.ptr, edtState->text().toUtf8());
set_str(&data->PCode.ptr, edtZip->text().toUtf8());
set_str(&data->Country.ptr, edtCountry->text().toUtf8());
}
示例12: restore_default
static void
restore_default(struct option *p)
{
switch(p -> type) {
case OT_BOOL:
set_bool(p -> data, (bool)p -> init);
break;
case OT_INT:
set_int(p -> data, (int)p -> init);
break;
case OT_STR:
if(p -> init)
set_str(p -> data, (char *) p -> init);
break;
default:
assert(0);
}
}
示例13: opt_set_set_option
static const char *
opt_set_set_option(char *p, struct option *opt)
{
int len;
assert(p);
strtrim(p);
len = strlen(p);
if(*p == '\"' && p[len - 1] == '\"') {
if(len < 3)
return _("invalid value");
p[len - 1] = 0;
p++;
}
switch(opt -> type) {
case OT_STR:
set_str(opt -> data, p);
break;
case OT_INT:
set_int(opt -> data, safe_atoi(p));
break;
case OT_KEYINT:
set_int(opt -> data, *p);
break;
case OT_BOOL:
if(!strcasecmp(p, "true") || !strcasecmp(p, "on"))
set_bool(opt -> data, TRUE);
else if(!strcasecmp(p, "false") ||
!strcasecmp(p, "off"))
set_bool(opt -> data, FALSE);
else
return _("invalid value");
break;
default:
assert(0);
}
return NULL;
}
示例14: set_note_str
int set_note_str(
pbs_attribute *attr,
pbs_attribute *new_attr,
enum batch_op op)
{
static char id[] = "set_note_str";
size_t nsize;
int rc = 0;
char log_buf[LOCAL_LOG_BUF_SIZE];
assert(attr && new_attr && new_attr->at_val.at_str && (new_attr->at_flags & ATR_VFLAG_SET));
nsize = strlen(new_attr->at_val.at_str); /* length of new note */
if (nsize > MAX_NOTE)
{
sprintf(log_buf, "Warning: Client attempted to set note with len (%d) > MAX_NOTE (%d)",
(int)nsize,
MAX_NOTE);
log_record(PBSEVENT_SECURITY,PBS_EVENTCLASS_REQUEST,id,log_buf);
rc = PBSE_BADNDATVAL;
}
if (strchr(new_attr->at_val.at_str, '\n') != NULL)
{
sprintf(log_buf, "Warning: Client attempted to set note with a newline char");
log_record(PBSEVENT_SECURITY,PBS_EVENTCLASS_REQUEST,id,log_buf);
rc = PBSE_BADNDATVAL;
}
if (rc != 0)
return(rc);
rc = set_str(attr, new_attr, op);
return(rc);
} /* END set_note_str() */
示例15: get_width_label_now
void CConfig::saveall(bool now)
{
if (label_enabled())
{
if (now)
{
width_label = get_width_label_now();
width_comment = get_width_comment_now();
}
if(width_label && width_comment)
{
set_int(WIDTH_LABEL, width_label);
set_int(WIDTH_COMMENT, width_comment);
}
}
set_int(LABEL_ENABLE, label_enabled_);
set_int(ENABLE_JMP, enable_jmp);
set_str(INI_PATH, (LPTSTR)ini_path.c_str());
}