本文整理汇总了C++中VALUE_TYPE函数的典型用法代码示例。如果您正苦于以下问题:C++ VALUE_TYPE函数的具体用法?C++ VALUE_TYPE怎么用?C++ VALUE_TYPE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VALUE_TYPE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rabbit_object_free
void rabbit_object_free( VALUE value )
{
assert( value );
if( !IS_PTR_VALUE(value) ) {
rabbit_bug("(object_free)ポインタ型では無いオブジェクトが送られてきました(type %d)", VALUE_TYPE(value) );
}
switch(VALUE_TYPE(value)) {
case TYPE_STRING:
free( R_STRING(value)->ptr );
break;
case TYPE_ARRAY:
free( R_ARRAY(value)->ptr );
break;
case TYPE_CLASS:
break;
case TYPE_OBJECT:
st_free_table( R_OBJECT(value)->ival_tbl );
R_OBJECT(value)->ival_tbl = 0;
break;
case TYPE_METHOD:
break;
default:
rabbit_bug("(object_free)未対応型のオブジェクトが送られてきました(type %d)", VALUE_TYPE(value) );
}
free( (void*)(value) );
}
示例2: OutputVcardAttribute
static int OutputVcardAttribute(MimeObject *aMimeObj, VObject *aVcard, const char* id, nsACString& vCardOutput)
{
VObject *prop = NULL;
nsAutoCString string;
nsCOMPtr<nsIMsgVCardService> vCardService = do_GetService(MSGVCARDSERVICE_CONTRACT_ID);
if (!vCardService)
return -1;
prop = vCardService->IsAPropertyOf(aVcard, id);
if (prop)
if (VALUE_TYPE(prop))
{
if (VALUE_TYPE(prop) != VCVT_RAW)
string.Adopt(vCardService->FakeCString(prop));
else
string.Adopt(vCardService->VObjectAnyValue(prop));
if (!string.IsEmpty())
{
vCardOutput += "<tr> <td class=\"moz-vcard-property\">";
vCardOutput += string;
vCardOutput += "</td> </tr> ";
}
}
return 0;
}
示例3: fakeCString
char *getCString(VObject *vObj)
{
if (VALUE_TYPE(vObj) == VCVT_USTRINGZ)
return fakeCString(vObjectUStringZValue(vObj));
if (VALUE_TYPE(vObj) == VCVT_STRINGZ)
return PL_strdup(vObjectStringZValue(vObj));
return NULL;
}
示例4: mi_cmd_data_evaluate_expression
/* Evaluate the value of the argument. The argument is an
expression. If the expression contains spaces it needs to be
included in double quotes. */
enum mi_cmd_result
mi_cmd_data_evaluate_expression (char *command, char **argv, int argc)
{
struct expression *expr;
struct cleanup *old_chain = NULL;
struct value *val;
struct ui_stream *stb = NULL;
stb = ui_out_stream_new (uiout);
if (argc != 1)
{
xasprintf (&mi_error_message,
"mi_cmd_data_evaluate_expression: Usage: -data-evaluate-expression expression");
return MI_CMD_ERROR;
}
expr = parse_expression (argv[0]);
old_chain = make_cleanup (free_current_contents, &expr);
val = evaluate_expression (expr);
/* Print the result of the expression evaluation. */
val_print (VALUE_TYPE (val), VALUE_CONTENTS (val),
VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
stb->stream, 0, 0, 0, 0);
ui_out_field_stream (uiout, "value", stb);
ui_out_stream_delete (stb);
do_cleanups (old_chain);
return MI_CMD_DONE;
}
示例5: VALUE_TYPE
DizList::desc_map::iterator DizList::AddRecord(const string& Name, const string& Description)
{
Modified=true;
std::list<string> DescStrings;
DescStrings.emplace_back(Description);
return DizData.insert(DizData.begin(), VALUE_TYPE(DizData)(Name, DescStrings));
}
示例6: DLLEXPORT
DLLEXPORT(void) cleanVObject(VObject *o)
{
if (o == 0) return;
if (o->prop) {
/* destroy time: cannot use the iterator here.
Have to break the cycle in the circular link
list and turns it into regular NULL-terminated
list -- since at some point of destruction,
the reference entry for the iterator to work
will not longer be valid.
*/
VObject *p;
p = o->prop->next;
o->prop->next = 0;
do {
VObject *t = p->next;
cleanVObject(p);
p = t;
} while (p);
}
switch (VALUE_TYPE(o)) {
case VCVT_STRINGZ:
case VCVT_RAW:
// assume they are all allocated by malloc.
free((char*)STRINGZ_VALUE_OF(o));
break;
case VCVT_VOBJECT:
cleanVObject(VOBJECT_VALUE_OF(o));
break;
}
deleteVObject(o);
}
示例7: writeValue
static void writeValue(OFile *fp, VObject *o, unsigned long size, bool nosemi)
{
if (o == 0) return;
switch (VALUE_TYPE(o)) {
case VCVT_STRINGZ: {
writeEncString(fp, STRINGZ_VALUE_OF(o), nosemi);
break;
}
case VCVT_UINT: {
char buf[16];
sprintf(buf,"%u", INTEGER_VALUE_OF(o));
appendsOFile(fp,buf);
break;
}
case VCVT_ULONG: {
char buf[16];
sprintf(buf,"%lu", LONG_VALUE_OF(o));
appendsOFile(fp,buf);
break;
}
case VCVT_RAW: {
appendcOFile(fp,'\n');
writeBase64(fp,(unsigned char*)(ANY_VALUE_OF(o)),size);
break;
}
case VCVT_VOBJECT:
appendcOFile(fp,'\n');
writeVObject_(fp,VOBJECT_VALUE_OF(o));
break;
}
}
示例8: gc_mark
void gc_mark( VALUE value )
{
if( !IS_PTR_VALUE(value) ) {
return;
}
if( FLAG_TEST( value, FLAG_GC_MARK ) ) {
return;
}
if( RANY(value)->as.free.flags == 0 ) {
return;
}
FLAG_SET( value, FLAG_GC_MARK );
gc_mark( R_BASIC(value)->klass );
switch(VALUE_TYPE(value))
{
case TYPE_STRING:
break;
case TYPE_ARRAY: {
int i;
for( i=0; i< R_ARRAY(value)->len; ++i ) {
gc_mark( R_ARRAY(value)->ptr[i] );
}
break;
}
case TYPE_CLASS:
gc_mark( (VALUE)(R_CLASS(value)->super) );
var_tbl_mark( R_CLASS(value)->ival_tbl );
var_tbl_mark( R_CLASS(value)->method_tbl );
break;
case TYPE_OBJECT:
gc_mark( (VALUE)(R_BASIC(value)->klass) );
var_tbl_mark( R_OBJECT(value)->ival_tbl );
break;
case TYPE_METHOD:
break;
default:
rabbit_bug("(GC MARK)未対応型のオブジェクトが送られてきました(type %d)", VALUE_TYPE(value) );
}
}
示例9: ada_value_print
int
ada_value_print (struct value *val0, struct ui_file *stream, int format,
enum val_prettyprint pretty)
{
char *valaddr = VALUE_CONTENTS (val0);
CORE_ADDR address = VALUE_ADDRESS (val0) + VALUE_OFFSET (val0);
struct type *type =
ada_to_fixed_type (VALUE_TYPE (val0), valaddr, address, NULL);
struct value *val =
value_from_contents_and_address (type, valaddr, address);
/* If it is a pointer, indicate what it points to. */
if (TYPE_CODE (type) == TYPE_CODE_PTR)
{
/* Hack: don't print (char *) for char strings. Their
type is indicated by the quoted string anyway. */
if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) != sizeof (char)
|| TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_INT
|| TYPE_UNSIGNED (TYPE_TARGET_TYPE (type)))
{
fprintf_filtered (stream, "(");
type_print (type, "", stream, -1);
fprintf_filtered (stream, ") ");
}
}
else if (ada_is_array_descriptor_type (type))
{
fprintf_filtered (stream, "(");
type_print (type, "", stream, -1);
fprintf_filtered (stream, ") ");
}
else if (ada_is_bogus_array_descriptor (type))
{
fprintf_filtered (stream, "(");
type_print (type, "", stream, -1);
fprintf_filtered (stream, ") (...?)");
return 0;
}
if (TYPE_CODE (type) == TYPE_CODE_ARRAY
&& TYPE_LENGTH (TYPE_TARGET_TYPE (type)) == 0
&& TYPE_CODE (TYPE_INDEX_TYPE (type)) == TYPE_CODE_RANGE)
{
/* This is an array of zero-length elements, that is an array
of null records. This array needs to be printed by hand,
as the standard routine to print arrays relies on the size of
the array elements to be nonzero. This is because it computes
the number of elements in the array by dividing the array size
by the array element size. */
fprintf_filtered (stream, "(%d .. %d => ())",
TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type)),
TYPE_HIGH_BOUND (TYPE_INDEX_TYPE (type)));
return 0;
}
return (val_print (type, VALUE_CONTENTS (val), 0, address,
stream, format, 1, 0, pretty));
}
示例10: writeProp
static void writeProp(OFile *fp, VObject *o)
{
int isQuoted=0;
if (NAME_OF(o)) {
const struct PreDefProp *pi;
VObjectIterator t;
const char **fields_ = 0;
pi = lookupPropInfo(NAME_OF(o));
if (pi && ((pi->flags & PD_BEGIN) != 0)) {
writeVObject_(fp,o);
return;
}
if (isAPropertyOf(o,VCGroupingProp))
writeGroup(fp,o);
else
appendsOFile(fp,NAME_OF(o));
if (pi) fields_ = pi->fields;
initPropIterator(&t,o);
while (moreIteration(&t)) {
const char *s;
VObject *eachProp = nextVObject(&t);
s = NAME_OF(eachProp);
if (strcasecmp(VCGroupingProp,s) && !inList(fields_,s))
writeAttrValue(fp,eachProp);
if (strcasecmp(VCQPProp,s)==0 || strcasecmp(VCQuotedPrintableProp,s)==0)
isQuoted=1;
}
if (fields_) {
int i = 0, n = 0;
const char** fields = fields_;
/* output prop as fields */
appendcOFile(fp,':');
while (*fields) {
VObject *tl = isAPropertyOf(o,*fields);
i++;
if (tl) n = i;
fields++;
}
fields = fields_;
for (i=0;i<n;i++) {
writeValue(fp,isAPropertyOf(o,*fields),0,isQuoted);
fields++;
if (i<(n-1)) appendcOFile(fp,';');
}
}
}
if (VALUE_TYPE(o)) {
unsigned long size = 0;
VObject *p = isAPropertyOf(o,VCDataSizeProp);
if (p) size = LONG_VALUE_OF(p);
appendcOFile(fp,':');
writeValue(fp,o,size,isQuoted);
}
appendcOFile(fp,'\n');
}
示例11: newVObject_
VObject* newVObject_(const char *id)
{
VObject *p = (VObject*) new(VObject);
p->next = 0;
p->id = id;
p->prop = 0;
VALUE_TYPE(p) = 0;
ANY_VALUE_OF(p) = 0;
return p;
}
示例12: write
void write(std::ostream& Stream, const container& Container)
{
static_assert(std::is_trivially_copyable_v<VALUE_TYPE(Container)>);
const auto Size = std::size(Container);
if (!Size)
return;
Stream.write(static_cast<const char*>(static_cast<const void*>(std::data(Container))), Size * sizeof(*std::data(Container)));
}
示例13: printNameValue
static void printNameValue(FILE *fp,VObject *o, int level)
{
indent(fp,level);
if (NAME_OF(o)) {
fprintf(fp,"%s", NAME_OF(o));
}
if (VALUE_TYPE(o)) {
fputc('=',fp);
printValue(fp,o, level);
}
fprintf(fp,"\n");
}
示例14: info_embedded_symbol_command
static void info_embedded_symbol_command (char *exp, int from_tty)
{
struct expression *expr;
struct value *val;
CORE_ADDR address;
struct embedded_symbol *sym;
expr = parse_expression (exp);
val = evaluate_expression (expr);
if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_REF)
val = value_ind (val);
if ((TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_FUNC) && (VALUE_LVAL (val) == lval_memory))
address = VALUE_ADDRESS (val);
else
address = value_as_address (val);
sym = search_for_embedded_symbol (address);
if (sym != NULL)
fprintf_unfiltered
(gdb_stderr, "Symbol at 0x%lx is \"%s\".\n", (unsigned long) address, sym->name);
else
fprintf_unfiltered
(gdb_stderr, "Symbol at 0x%lx is unknown.\n", (unsigned long) address);
}
示例15: writeAttrValue
static void writeAttrValue(OFile *fp, VObject *o)
{
if (NAME_OF(o)) {
struct PreDefProp *pi;
pi = lookupPropInfo(NAME_OF(o));
if (pi && ((pi->flags & PD_INTERNAL) != 0)) return;
appendcOFile(fp,';');
appendsOFile(fp,NAME_OF(o));
}
else
appendcOFile(fp,';');
if (VALUE_TYPE(o)) {
appendcOFile(fp,'=');
writeValue(fp,o,0);
}
}