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


C++ read_uint函数代码示例

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


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

示例1: read_uint

EnumSig *Parser::parse_enum_sig() {
    size_t id = read_uint();

    EnumSigState *sig = lookup(enums, id);

    if (!sig) {
        /* parse the signature */
        sig = new EnumSigState;
        sig->id = id;
        sig->num_values = read_uint();
        EnumValue *values = new EnumValue[sig->num_values];
        for (EnumValue *it = values; it != values + sig->num_values; ++it) {
            it->name = read_string();
            it->value = read_sint();
        }
        sig->values = values;
        sig->fileOffset = file->currentOffset();
        enums[id] = sig;
    } else if (file->currentOffset() < sig->fileOffset) {
        /* skip over the signature */
        int num_values = read_uint();
        for (int i = 0; i < num_values; ++i) {
            skip_string(); /*name */
            skip_sint(); /* value */
        }
    }

    assert(sig);
    return sig;
}
开发者ID:casseveritt,项目名称:apitrace,代码行数:30,代码来源:trace_parser.cpp

示例2: read_uint

Value *Parser::parse_wstring() {
    size_t len = read_uint();
    wchar_t * value = new wchar_t[len + 1];
    for (size_t i = 0; i < len; ++i) {
        value[i] = read_uint();
    }
    value[len] = 0;
#if TRACE_VERBOSE
    std::cerr << "\tWSTRING \"" << value << "\"\n";
#endif
    return new WString(value);
}
开发者ID:bbvch,项目名称:OpenGLStreamingWithQt,代码行数:12,代码来源:trace_parser.cpp

示例3: set_label

void Version::from_bip(char*& cursor)
{
	set_label(read_string(cursor));
	if(!label().empty()) set_exists();
	int num_deps = read_uint(cursor);
	_deps.clear();
	_deps.reserve(num_deps);
	for(int i=0; i < num_deps; i++)
	{
		Package::Ptr pkg = dataset.package(read_uint(cursor));
		Version::Ptr dep = pkg->version(time());
		add_dep(dep);
	}
}
开发者ID:Recmo,项目名称:depgraph,代码行数:14,代码来源:version.cpp

示例4: lbm_read_state_binary

void lbm_read_state_binary(FILE * handle, LbmState * lbm_state)
{
	size_t i;

	read_uint(handle, &lbm_state->lx);
	read_uint(handle, &lbm_state->ly);

	size_t nodes = lbm_state->lx * lbm_state->ly;

	for(i = 0; i < Q; ++i)
		read_n_doubles(handle, lbm_state->f[i], nodes);
	for(i = 0; i < Q; ++i)
		read_n_doubles(handle, lbm_state->f_next[i], nodes);
}
开发者ID:dawuweijun,项目名称:clbm,代码行数:14,代码来源:clbm.c

示例5: switch

bool SkFontDescriptor::Deserialize(SkStream* stream, SkFontDescriptor* result) {
    result->fStyle = (SkTypeface::Style)stream->readPackedUInt();

    SkAutoSTMalloc<4, SkFixed> axis;
    size_t axisCount = 0;
    size_t index = 0;
    for (size_t id; (id = stream->readPackedUInt()) != kSentinel;) {
        switch (id) {
            case kFontFamilyName:
                read_string(stream, &result->fFamilyName);
                break;
            case kFullName:
                read_string(stream, &result->fFullName);
                break;
            case kPostscriptName:
                read_string(stream, &result->fPostscriptName);
                break;
            case kFontAxes:
                axisCount = read_uint(stream);
                axis.reset(axisCount);
                for (size_t i = 0; i < axisCount; ++i) {
                    axis[i] = read_uint(stream);
                }
                break;
            case kFontIndex:
                index = read_uint(stream);
                break;
            case kFontFileName:  // Remove when MIN_PICTURE_VERSION > 41
                skip_string(stream);
                break;
            default:
                SkDEBUGFAIL("Unknown id used by a font descriptor");
                return false;
        }
    }

    size_t length = stream->readPackedUInt();
    if (length > 0) {
        SkAutoTUnref<SkData> data(SkData::NewUninitialized(length));
        if (stream->read(data->writable_data(), length) == length) {
            result->fFontData.reset(new SkFontData(new SkMemoryStream(data),
                                                   index, axis, axisCount));
        } else {
            SkDEBUGFAIL("Could not read font data");
            return false;
        }
    }
    return true;
}
开发者ID:YangchenVR,项目名称:skia,代码行数:49,代码来源:SkFontDescriptor.cpp

示例6: assert

bool Parser::open(const char *filename) {
    assert(!file);
    if (filename)
    {
#ifndef __EMSCRIPTEN__
        file = File::createForRead(filename);
#endif
        if (!file) {
            return false;
        }

        version = read_uint();
        if (version > TRACE_VERSION) {
            std::cerr << "error: unsupported trace format version " << version << "\n";
            delete file;
            file = NULL;
            return false;
        }
    }
    else {
        version = 5; // TODO version is temporary hard coded
        file = File::createBufferReader();
        if (!file) {
            return false;
        }
        file->open("", File::Mode::ReadWrite);

    }
    api = API_UNKNOWN;

    return true;
}
开发者ID:bbvch,项目名称:OpenGLStreamingWithQt,代码行数:32,代码来源:trace_parser.cpp

示例7: rd_monster

static void rd_monster(monster_type *m_ptr)
{
	start_section_read("monster");

	/* Hack -- wipe */
	WIPE(m_ptr, monster_type);

	skip_value("name");

	/* Read the monster race */
	m_ptr->r_idx = read_int("r_idx");

	/* Read the other information */
	m_ptr->fy = read_int("fy");
	m_ptr->fx = read_int("fx");
	m_ptr->dun_depth = read_int("dun_depth");
	m_ptr->hp = read_int("hp");
	m_ptr->maxhp = read_int("maxhp");
	m_ptr->csleep = read_int("csleep");
	m_ptr->mspeed = read_int("mspeed");
	m_ptr->energy = read_uint("energy");
	m_ptr->stunned = read_int("stunned");
	m_ptr->confused = read_int("confused");
	m_ptr->monfear = read_int("afraid");

	end_section_read("monster");
}
开发者ID:evileye-uk,项目名称:mangband,代码行数:27,代码来源:load2.c

示例8: read_uint

/*
 * Old enum signatures would cover a single name/value only:
 *
 *   enum_sig = id name value
 *            | id
 */
EnumSig *Parser::parse_old_enum_sig() {
    size_t id = read_uint();

    EnumSigState *sig = lookup(enums, id);

    if (!sig) {
        /* parse the signature */
        sig = new EnumSigState;
        sig->id = id;
        sig->num_values = 1;
        EnumValue *values = new EnumValue[sig->num_values];
        values->name = read_string();
        values->value = read_sint();
        sig->values = values;
        sig->offset = file->currentOffset();
        enums[id] = sig;
    } else if (file->currentOffset() < sig->offset) {
        /* skip over the signature */
        skip_string(); /*name*/
        scan_value();
    }

    assert(sig);
    return sig;
}
开发者ID:netconstructor,项目名称:apitrace,代码行数:31,代码来源:trace_parser.cpp

示例9: parse_bitmask_sig

Value *Parser::parse_bitmask() {
    BitmaskSig *sig = parse_bitmask_sig();

    unsigned long long value = read_uint();

    return new Bitmask(sig, value);
}
开发者ID:netconstructor,项目名称:apitrace,代码行数:7,代码来源:trace_parser.cpp

示例10: read_byte

/*
 * For the time being, a signed int is encoded as any other value, but we here parse
 * it without the extra baggage of the Value class.
 */
signed long long
Parser::read_sint(void) {
    int c;
    c = read_byte();
    switch (c) {
    case trace::TYPE_SINT:
        return -read_uint();
    case trace::TYPE_UINT:
        return read_uint();
    default:
        std::cerr << "error: unexpected type " << c << "\n";
        exit(1);
    case -1:
        return 0;
    }
}
开发者ID:netconstructor,项目名称:apitrace,代码行数:20,代码来源:trace_parser.cpp

示例11: test_small_writes

/* Test writing single values of various types to board's global memory.
 * The test passes if we read back what we wrote. */
void test_small_writes  (ssize_t f) {

  unsigned char     uc;
  unsigned short    us;
  unsigned int      ui;
  unsigned long int uli;

  write_uchar     (f, 0, 0, 19);
  uc = read_uchar (f, 0, 0);
  assert (uc == 19);
  
  write_ushort    (f, 0, 0, 13);
  us = read_ushort(f, 0, 0);
  assert (us == 13);

  write_ulong      (f, 0, 0, 0x3037383633352030);
  uli = read_ulong (f, 0, 0);
  assert (uli == 0x3037383633352030);
  
  write_uint     (f, 0, 0, 18987983);
  ui = read_uint (f, 0, 0);
  assert (ui == 18987983);
  
  printf ("test_small_writes PASSED\n");
}
开发者ID:eddiehung,项目名称:dox-legup,代码行数:27,代码来源:user.c

示例12: if

bool
Model::load(std::istream & ifs) {
  char chunk[16];
  ifs.read(chunk, 16);

  if (!strcmp(chunk, SEGMENTOR_MODEL_FULL)) {
    full = true;
  } else if (!strcmp(chunk, SEGMENTOR_MODEL) ||
      !strcmp(chunk, SEGMENTOR_MODEL_MINIMAL)) {
    full = false;
  } else {
    return false;
  }

  if (full) {
    ifs.read(reinterpret_cast<char *>(&end_time), sizeof(int));
  } else {
    end_time = 0;
  }

  unsigned labels_offset    = read_uint(ifs);
  unsigned lexicon_offset   = read_uint(ifs);
  unsigned feature_offset   = read_uint(ifs);
  unsigned parameter_offset = read_uint(ifs);

  ifs.seekg(labels_offset);
  if (!labels.load(ifs)) {
    return false;
  }

  ifs.seekg(lexicon_offset);
  if (!internal_lexicon.load(ifs)) {
    return false;
  }

  ifs.seekg(feature_offset);
  if (!space.load(labels.size(), ifs)) {
    return false;
  }

  ifs.seekg(parameter_offset);
  if (!param.load(ifs, full)) {
    return false;
  }

  return true;
}
开发者ID:XiaoboYuan,项目名称:ltp,代码行数:47,代码来源:model.cpp

示例13: read_uint

void Parser::parse_arg(Call *call) {
    unsigned index = read_uint();
    Value *value = parse_value();
    if (index >= call->args.size()) {
        call->args.resize(index + 1);
    }
    call->args[index] = value;
}
开发者ID:pzick,项目名称:apitrace,代码行数:8,代码来源:trace_parser.cpp

示例14: rd_wild

static void rd_wild(int n)
{
	wilderness_type *w_ptr = &wild_info[-n];
	
	/* the flags */
	w_ptr->flags = read_uint("flags");
	
}
开发者ID:evileye-uk,项目名称:mangband,代码行数:8,代码来源:load2.c

示例15: load_qstr

STATIC qstr load_qstr(mp_reader_t *reader) {
    size_t len = read_uint(reader);
    char *str = m_new(char, len);
    read_bytes(reader, (byte*)str, len);
    qstr qst = qstr_from_strn(str, len);
    m_del(char, str, len);
    return qst;
}
开发者ID:BWhitten,项目名称:micropython,代码行数:8,代码来源:persistentcode.c


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