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


C++ Status::codeString方法代码示例

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


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

示例1: validateIndexKey

 BSONObj validateIndexKey(const BSONObj& a, void* data) {
     BSONObj key = a[0].Obj();
     Status indexValid = validateKeyPattern(key);
     if (!indexValid.isOK()) {
         return BSON("" << BSON("ok" << false << "errmsg" << indexValid.codeString()));
     }
     return BSON("" << BSON("ok" << true));
 }
开发者ID:devplayerJoe,项目名称:mongo,代码行数:8,代码来源:shell_utils.cpp

示例2: _acquirePrivilegesForPrincipalFromDatabase

    void AuthorizationManager::_acquirePrivilegesForPrincipalFromDatabase(
            const std::string& dbname, const PrincipalName& principal) {

        BSONObj privilegeDocument;
        Status status = getPrivilegeDocument(dbname, principal, &privilegeDocument);
        if (status.isOK()) {
            status = acquirePrivilegesFromPrivilegeDocument(dbname, principal, privilegeDocument);
        }
        if (!status.isOK() && status != ErrorCodes::UserNotFound) {
            log() << "Privilege acquisition failed for " << principal << " in database " <<
                dbname << ": " << status.reason() << " (" << status.codeString() << ")" << endl;
        }
    }
开发者ID:chenbk85,项目名称:mongo,代码行数:13,代码来源:authorization_manager.cpp

示例3: _acquirePrivilegesForPrincipalFromDatabase

    void AuthorizationSession::_acquirePrivilegesForPrincipalFromDatabase(
            const std::string& dbname, const UserName& user) {

        BSONObj privilegeDocument;
        Status status = _externalState->getAuthorizationManager().getPrivilegeDocument(
                dbname, user, &privilegeDocument);
        if (status.isOK()) {
            status = acquirePrivilegesFromPrivilegeDocument(dbname, user, privilegeDocument);
        }
        if (!status.isOK() && status != ErrorCodes::UserNotFound) {
            log() << "Privilege acquisition failed for " << user << " in database " <<
                dbname << ": " << status.reason() << " (" << status.codeString() << ")" << endl;
        }
    }
开发者ID:citsoft,项目名称:mongo,代码行数:14,代码来源:authorization_session.cpp

示例4: run

 virtual bool run(const string &db, BSONObj &cmdObj, int options, string &errmsg, BSONObjBuilder &result, bool fromRepl) {
     BSONElement e = cmdObj.firstElement();
     long long bps;
     if (e.type() == String) {
         Status status = BytesQuantity<long long>::fromString(e.Stringdata(), bps);
         if (!status.isOK()) {
             stringstream ss;
             ss << "error parsing number " << e.Stringdata() << ": " << status.codeString() << " " << status.reason();
             errmsg = ss.str();
             return false;
         }
     }
     else {
         if (!e.isNumber()) {
             errmsg = "backupThrottle argument must be a number";
             return false;
         }
         bps = e.safeNumberLong();
     }
     return Manager::throttle(bps, errmsg, result);
 }
开发者ID:percona,项目名称:tokumx-backup-plugin,代码行数:21,代码来源:backup_plugin.cpp

示例5: uasserted

void ObjectInfo::Functions::invalidForStorage::call(JSContext* cx, JS::CallArgs args) {
    if (args.length() != 1)
        uasserted(ErrorCodes::BadValue, "invalidForStorage needs 1 argument");

    if (args.get(0).isNull()) {
        args.rval().setNull();
        return;
    }

    if (!args.get(0).isObject())
        uasserted(ErrorCodes::BadValue, "argument to invalidForStorage has to be an object");

    Status validForStorage = ValueWriter(cx, args.get(0)).toBSON().storageValid(true);
    if (validForStorage.isOK()) {
        args.rval().setNull();
        return;
    }

    std::string errmsg = str::stream() << validForStorage.codeString() << ": "
                                       << validForStorage.reason();

    ValueReader(cx, args.rval()).fromStringData(errmsg);
}
开发者ID:stevelyall,项目名称:mongol-db,代码行数:23,代码来源:object.cpp


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