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


C++ headers_t::find方法代码示例

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


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

示例1: is_need_check_obj_detail

//
// Returns it whether it is an object with need checking in detail.
// If this function returns true, the object is possible to be directory
// and is needed checking detail(searching sub object).
//
bool is_need_check_obj_detail(headers_t& meta)
{
  headers_t::const_iterator iter;

  // directory object is Content-Length as 0.
  if(0 != get_size(meta)){
    return false;
  }
  // if the object has x-amz-meta information, checking is no more.
  if(meta.end() != meta.find("x-amz-meta-mode")  ||
     meta.end() != meta.find("x-amz-meta-mtime") ||
     meta.end() != meta.find("x-amz-meta-uid")   ||
     meta.end() != meta.find("x-amz-meta-gid")   ||
     meta.end() != meta.find("x-amz-meta-owner") ||
     meta.end() != meta.find("x-amz-meta-group") ||
     meta.end() != meta.find("x-amz-meta-permissions") )
  {
    return false;
  }
  // if there is not Content-Type, or Content-Type is "x-directory",
  // checking is no more.
  if(meta.end() == (iter = find_content_type(meta))){
    return false;
  }
  if("application/x-directory" == (*iter).second){
    return false;
  }
  return true;
}
开发者ID:pcdingman,项目名称:s3fs-fuse,代码行数:34,代码来源:s3fs_util.cpp

示例2: get_mode

mode_t get_mode(headers_t& meta, const char* path, bool checkdir, bool forcedir)
{
  mode_t mode = 0;
  bool isS3sync = false;
  headers_t::const_iterator iter;

  if(meta.end() != (iter = meta.find("x-amz-meta-mode"))){
    mode = get_mode((*iter).second.c_str());
  }else{
    if(meta.end() != (iter = meta.find("x-amz-meta-permissions"))){ // for s3sync
      mode = get_mode((*iter).second.c_str());
      isS3sync = true;
    }
  }
  // Checking the bitmask, if the last 3 bits are all zero then process as a regular
  // file type (S_IFDIR or S_IFREG), otherwise return mode unmodified so that S_IFIFO,
  // S_IFSOCK, S_IFCHR, S_IFLNK and S_IFBLK devices can be processed properly by fuse.
  if(!(mode & S_IFMT)){
    if(!isS3sync){
      if(checkdir){
        if(forcedir){
          mode |= S_IFDIR;
        }else{
          if(meta.end() != (iter = find_content_type(meta))){
            string strConType = (*iter).second;
            // Leave just the mime type, remove any optional parameters (eg charset)
            string::size_type pos = strConType.find(";");
            if(string::npos != pos){
              strConType = strConType.substr(0, pos);
            }
            if(strConType == "application/x-directory"){
              mode |= S_IFDIR;
            }else if(path && 0 < strlen(path) && '/' == path[strlen(path) - 1]){
              if(strConType == "binary/octet-stream" || strConType == "application/octet-stream"){
                mode |= S_IFDIR;
              }else{
                mode |= S_IFREG;
              }
            }else{
              mode |= S_IFREG;
            }
          }else{
            mode |= S_IFREG;
          }
        }
      }
    }else{
      if(!checkdir){
        // cut dir/reg flag.
        mode &= ~S_IFDIR;
        mode &= ~S_IFREG;
      }
    }
  }
  return mode;
}
开发者ID:pcdingman,项目名称:s3fs-fuse,代码行数:56,代码来源:s3fs_util.cpp

示例3: get_gid

gid_t get_gid(headers_t& meta)
{
  headers_t::const_iterator iter;
  if(meta.end() == (iter = meta.find("x-amz-meta-gid"))){
    if(meta.end() == (iter = meta.find("x-amz-meta-group"))){ // for s3sync
      return 0;
    }
  }
  return get_gid((*iter).second.c_str());
}
开发者ID:pcdingman,项目名称:s3fs-fuse,代码行数:10,代码来源:s3fs_util.cpp

示例4:

inline headers_t::const_iterator find_content_type(headers_t& meta)
{
  headers_t::const_iterator iter;

  if(meta.end() == (iter = meta.find("Content-Type"))){
    if(meta.end() == (iter = meta.find("Content-type"))){
      if(meta.end() == (iter = meta.find("content-type"))){
        iter = meta.find("content-Type");
      }
    }
  }
  return iter;
}
开发者ID:pcdingman,项目名称:s3fs-fuse,代码行数:13,代码来源:s3fs_util.cpp

示例5: get_lastmodified

time_t get_lastmodified(headers_t& meta)
{
  headers_t::const_iterator iter;
  if(meta.end() == (iter = meta.find("Last-Modified"))){
    return 0;
  }
  return get_lastmodified((*iter).second.c_str());
}
开发者ID:pcdingman,项目名称:s3fs-fuse,代码行数:8,代码来源:s3fs_util.cpp

示例6: get_size

off_t get_size(headers_t& meta)
{
  headers_t::const_iterator iter;
  if(meta.end() == (iter = meta.find("Content-Length"))){
    return 0;
  }
  return get_size((*iter).second.c_str());
}
开发者ID:pcdingman,项目名称:s3fs-fuse,代码行数:8,代码来源:s3fs_util.cpp

示例7: get_mtime

time_t get_mtime(headers_t& meta, bool overcheck)
{
  headers_t::const_iterator iter;
  if(meta.end() == (iter = meta.find("x-amz-meta-mtime"))){
    if(overcheck){
      return get_lastmodified(meta);
    }
    return 0;
  }
  return get_mtime((*iter).second.c_str());
}
开发者ID:pcdingman,项目名称:s3fs-fuse,代码行数:11,代码来源:s3fs_util.cpp


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