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


C++ string_t::chars方法代码示例

本文整理汇总了C++中string_t::chars方法的典型用法代码示例。如果您正苦于以下问题:C++ string_t::chars方法的具体用法?C++ string_t::chars怎么用?C++ string_t::chars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在string_t的用法示例。


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

示例1: defined

    virtual bool open_file
    (io::read::file& file, const string_t& line,
     const string_t& name, bool mode_is_binary = false) {
        size_t length;

        if ((line.has_chars(length))) {
#if defined(__GNUC__)
            char_t chars[length + 3];
#else // defined(__GNUC__)
            nadir::arrayt<char_t> a(length + 3);
            char_t* chars = a.elements();
#endif // defined(__GNUC__)

            if ((file.open(name.chars(), (mode_is_binary)
                ?(file.mode_read_binary()):(file.mode_read())))) {
                if (!((length + 2) != (file.read(chars, length + 2)))) {
                    if (!(line.compare(chars, length))) {
                        if (!((cr_ != chars[length]) || (lf_ != chars[length+1]))) {
                            return true;
                        }
                    }
                }
                file.close();
            }
        }
        return false;
    }
开发者ID:medusade,项目名称:coral,代码行数:27,代码来源:main.hpp

示例2: name

    virtual void on_file_entry
    (const fs::directory::entry& e, fs::path::parts& p,
     const string_t& source, const string_t& target) {
        const char_t *chars;
        size_t length;

        if ((chars = target.chars(length)) && (0 < length)) {
            fs::path::directory::name name(chars, length);

            name.append(e.directory());
            name.append(e.name());

            if ((on_match_file_entry_target(e, name))) {
                out(before_.c_str());
                if ((source_on_)) {
                    if ((name_on_)) {
                        out(e.path());
                    } else {
                        out(e.directory());
                    }
                    out(between_.c_str());
                }
                if ((target_on_)) {
                    if ((name_on_)) {
                        out(name.chars());
                    } else {
                        fs::path::directory::name directory(chars, length);
                        directory.append(e.directory());
                        out(directory.chars());
                    }
                }
                out(after_.c_str());
                if ((ln_on_)) {
                    outln();
                }
            }
        } else {
            out(before_.c_str());
            if ((source_on_)) {
                if ((name_on_)) {
                    out(e.path());
                } else {
                    out(e.directory());
                }
            }
            out(after_.c_str());
            if ((ln_on_)) {
                outln();
            }
        }
    }
开发者ID:medusade,项目名称:evelation,代码行数:51,代码来源:main.hpp


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