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


C++ Cell::GetType方法代码示例

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


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

示例1: FormatCell

MEDUSA_NAMESPACE_BEGIN

  bool Architecture::FormatCell(
  Document      const& rDoc,
  BinaryStream  const& rBinStrm,
  Address       const& rAddr,
  Cell          const& rCell,
  std::string        & rStrCell,
  Cell::Mark::List   & rMarks) const
{
  switch (rCell.GetType())
  {
  case Cell::InstructionType: return FormatInstruction(rDoc, rBinStrm, rAddr, static_cast<Instruction const&>(rCell), rStrCell, rMarks);
  case Cell::ValueType:       return FormatValue      (rDoc, rBinStrm, rAddr, static_cast<Value       const&>(rCell), rStrCell, rMarks);
  case Cell::CharacterType:   return FormatCharacter  (rDoc, rBinStrm, rAddr, static_cast<Character   const&>(rCell), rStrCell, rMarks);
  case Cell::StringType:      return FormatString     (rDoc, rBinStrm, rAddr, static_cast<String      const&>(rCell), rStrCell, rMarks);
  default:                    return false;
  }
}
开发者ID:anat,项目名称:medusa,代码行数:19,代码来源:architecture.cpp

示例2: if

nsresult
mozSqlResultODBC::BuildRows()
{
  while (SQL_SUCCEEDED(SQLFetch(mResult))) {
    nsCOMPtr<nsIRDFResource> resource;
    nsresult rv = gRDFService->GetAnonymousResource(getter_AddRefs(resource));
    if (NS_FAILED(rv)) return rv;

    Row* row = Row::Create(mAllocator, resource, mColumnInfo);

    for (PRInt32 j = 0; j < mColumnInfo.Count(); j++) {
      SQLINTEGER indicator;
      SQLCHAR buf[512];
      if(SQL_SUCCEEDED(SQLGetData(mResult, j+1, SQL_C_TCHAR, buf, sizeof(buf), &indicator)) && indicator != SQL_NULL_DATA) {
        char* value = (char*)buf;
        Cell* cell = row->mCells[j];
        cell->SetNull(PR_FALSE);
        PRInt32 type = cell->GetType();
        if (type == mozISqlResult::TYPE_STRING)
          cell->SetString(ToNewUnicode(nsDependentCString(value)));
        else if (type == mozISqlResult::TYPE_INT)
          PR_sscanf(value, "%d", &cell->mInt);
        else if (type == mozISqlResult::TYPE_FLOAT)
          PR_sscanf(value, "%f", &cell->mFloat);
        else if (type == mozISqlResult::TYPE_DECIMAL)
          PR_sscanf(value, "%f", &cell->mFloat);
        else if (type == mozISqlResult::TYPE_DATE ||
                 type == mozISqlResult::TYPE_TIME ||
                 type == mozISqlResult::TYPE_DATETIME)
          PR_ParseTimeString(value, PR_FALSE, &cell->mDate);
        else if (type == mozISqlResult::TYPE_BOOL)
          cell->mBool = !strcmp(value, "t");

      }
    }

    mRows.AppendElement(row);
    nsVoidKey key(resource);
    mSources.Put(&key, row);
  }

  return NS_OK;
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:43,代码来源:mozSqlResultODBC.cpp

示例3: FormatCell

bool Architecture::FormatCell(
    Document      const& rDoc,
    Address       const& rAddr,
    Cell          const& rCell,
    PrintData          & rPrintData) const
{
    switch (rCell.GetType())
    {
    case Cell::InstructionType:
        return FormatInstruction(rDoc, rAddr, static_cast<Instruction const&>(rCell), rPrintData);
    case Cell::ValueType:
        return FormatValue      (rDoc, rAddr, static_cast<Value       const&>(rCell), rPrintData);
    case Cell::CharacterType:
        return FormatCharacter  (rDoc, rAddr, static_cast<Character   const&>(rCell), rPrintData);
    case Cell::StringType:
        return FormatString     (rDoc, rAddr, static_cast<String      const&>(rCell), rPrintData);
    default:
        return false;
    }
}
开发者ID:johnjohnsp1,项目名称:medusa,代码行数:20,代码来源:architecture.cpp

示例4: Parse_Lambda

// (lambda (x) e1 e2) => (lamba (a) (begin e1 e2))
Cell* Parser::Parse_Lambda(Cell* cell)
{
    THROW_ERROR_IF(cell->Length() < 3, cell, "'lambda' does not take " << cell->Length() << " arguments");
    
    Cell* pArgs = cell->Cdr()->Car();
    if (pArgs->IsPair())
    {
        Cell* pCurrent = pArgs;
        while(pCurrent && pCurrent->Car())
        {
            THROW_ERROR_IF(!(pCurrent->Car()->GetType() & Cell::SymbolType), cell,  "'lambda' arg is not a symbol: " << pCurrent);
            pCurrent = pCurrent->Cdr();
        }
    }
    else
    {
        THROW_ERROR_IF(!(pArgs->GetType() & Cell::SymbolType), cell, "'lambda' arg is not a symbol or list: " << pArgs);
    }

    // (_lambda (args) ... (body) / (begin (body) (body))
    Cell* pLambda(Cell::Pair(Cell::Symbol(Sym::Symbol("_lambda")), nullptr));
    pLambda->Append(pArgs);
 
    Cell* pBody = cell->Cdr()->Cdr();
    if (pBody->Length() == 1)
    {
        // Parse the single body argument, no need for a begin
        pLambda->Append(Parse_Cell(pBody->Car()));
    }
    else
    {
        // Append all the body arguments as a begin
        Cell* pBegin = Cell::Pair(Cell::Symbol(Sym::Symbol("_begin")));
        pBegin = AppendCells(pBody, pBegin);
        pBegin = Parse_Cell(pBegin);

        pLambda->Append(pBegin); 
    }

    return pLambda;
}
开发者ID:cmaughan,项目名称:JorvikScheme,代码行数:42,代码来源:Parser.cpp

示例5: if

nsresult
mozSqlResultMysql::BuildRows()
{
  MYSQL_ROW resultrow;
  while ((resultrow = mysql_fetch_row(mResult))){
    nsCOMPtr<nsIRDFResource> resource;
    nsresult rv = gRDFService->GetAnonymousResource(getter_AddRefs(resource));
    if (NS_FAILED(rv)) return rv;

    Row* row = Row::Create(mAllocator, resource, mColumnInfo);

    for (PRInt32 j = 0; j < mColumnInfo.Count(); j++) {
      char* value = resultrow[j];
      if (value){
        Cell* cell = row->mCells[j];
        cell->SetNull(PR_FALSE);
        PRInt32 type = cell->GetType();
        if (type == mozISqlResult::TYPE_STRING)
          cell->SetString(UTF8ToNewUnicode(nsDependentCString(value)));
        else if (type == mozISqlResult::TYPE_INT)
          PR_sscanf(value, "%d", &cell->mInt);
        else if (type == mozISqlResult::TYPE_FLOAT)
          PR_sscanf(value, "%f", &cell->mFloat);
        else if (type == mozISqlResult::TYPE_DECIMAL)
          PR_sscanf(value, "%f", &cell->mFloat);
        else if (type == mozISqlResult::TYPE_DATE ||
                 type == mozISqlResult::TYPE_TIME ||
                 type == mozISqlResult::TYPE_DATETIME)
          PR_ParseTimeString(value, PR_FALSE, &cell->mDate);
        else if (type == mozISqlResult::TYPE_BOOL)
          cell->mBool = !strcmp(value, "t");
      }
    }

    mRows.AppendElement(row);
    nsVoidKey key(resource);
    mSources.Put(&key, row);
  }

  return NS_OK;
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:41,代码来源:mozSqlResultMysql.cpp

示例6: Parse_Define

Cell* Parser::Parse_Define(Cell* cell, bool topLevel)
{
    UNUSED(topLevel);
    THROW_ERROR_IF(cell->Length() < 3, cell, "'define' does not take " << cell->Length() << " arguments");

    // Example: (define (add a b) (+ a b))
    // (define add (lambda (a b) (+ a b)))
    Cell* pParams = cell->Cdr()->Car();
    Cell* pBody = cell->Cdr()->Cdr();
               
    // (define (f args..) body)
    // Parse the arguments, if necessary, and call back into the Parse
    if (pParams->GetType() & Cell::PairType)
    {
        // f
        Cell* f = pParams->Car();

        // (Args)
        Cell* args = pParams->Cdr();

        // (define)
        Cell* pDefine = Cell::Pair(Cell::Symbol(Sym::Symbol("_define")), nullptr);
        
        // (lambda)
        Cell* pLambda = Cell::Pair(Cell::Symbol(Sym::Symbol("_lambda")), nullptr);
        
        // (lambda (args)
        pLambda = pLambda->Append(args);

        // (lambda (args) (body)
        // Body is a list of expressions. ((+ a a) ...)
        while (pBody && pBody->Car())
        {
            pLambda = pLambda->Append(pBody->Car());
            pBody = pBody->Cdr();
        }
        
        // (define f)
        pDefine = pDefine->Append(f);

        // (define f (lamda ...))
        pDefine = pDefine->Append(pLambda);

        return Parse_Cell(pDefine);
    }
    // A parsed define, ready to store
    else
    {
        THROW_ERROR_IF(cell->Length()!= 3, cell, "'define' does not take " << cell->Length() << " arguments");
        THROW_ERROR_IF(!(pParams->GetType() & Cell::SymbolType), cell, "Expected Symbol in define");
        
        pBody = Parse_Cell(pBody->Car());

        // (define)
        Cell* pDefine = Cell::Pair(Cell::Symbol(Sym::Symbol("_define")), nullptr);

        // (define (params)
        pDefine = pDefine->Append(pParams);

        // (define (params) (pBody))
        pDefine = pDefine->Append(pBody);

        return pDefine;
    }
}
开发者ID:cmaughan,项目名称:JorvikScheme,代码行数:65,代码来源:Parser.cpp

示例7: cell_to_bool

 /**
  * Converts a Cell to a bool.  Handles nullptr which is used to
  * indicate an empty list.
  */
 inline bool cell_to_bool(Cell cell) {
     return (cell != empty_list and (cell->GetType() != kCellType_bool || static_cast<bool_cell*>(cell.get())->GetValue()));
 }
开发者ID:grahamboree,项目名称:elisp,代码行数:7,代码来源:cells.cpp


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