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


C++ CommandInterpreter类代码示例

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


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

示例1:

void
CommandObject::GetArgumentHelp (Stream &str, CommandArgumentType arg_type, CommandInterpreter &interpreter)
{
    const ArgumentTableEntry* table = CommandObject::GetArgumentTable();
    ArgumentTableEntry *entry = (ArgumentTableEntry *) &(table[arg_type]);
    
    // The table is *supposed* to be kept in arg_type order, but someone *could* have messed it up...

    if (entry->arg_type != arg_type)
        entry = CommandObject::FindArgumentDataByType (arg_type);

    if (!entry)
        return;

    StreamString name_str;
    name_str.Printf ("<%s>", entry->arg_name);

    if (entry->help_function)
    {
        const char* help_text = entry->help_function();
        if (!entry->help_function.self_formatting)
        {
            interpreter.OutputFormattedHelpText (str, name_str.GetData(), "--", help_text,
                                                 name_str.GetSize());
        }
        else
        {
            interpreter.OutputHelpText(str, name_str.GetData(), "--", help_text,
                                       name_str.GetSize());
        }
    }
    else
        interpreter.OutputFormattedHelpText (str, name_str.GetData(), "--", entry->help_text, name_str.GetSize());
}
开发者ID:filcab,项目名称:lldb,代码行数:34,代码来源:CommandObject.cpp

示例2: ListSelection

bool
FilesType::List( CommandInterpreter& inInterpreter )
{
  string dir = inInterpreter.GetOptionalToken(),
         wildcard = inInterpreter.GetOptionalToken();
  return DirectoryType::ListSelection( inInterpreter, dir, wildcard, &FileUtils::IsFile );
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:7,代码来源:FileSystemTypes.cpp

示例3:

bool
DirectoryType::Exists( CommandInterpreter& inInterpreter )
{
  bool result = FileUtils::IsDirectory( inInterpreter.GetToken() );
  inInterpreter.Out() << ( result ? "true" : "false" );
  return true;
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:7,代码来源:FileSystemTypes.cpp

示例4: lock

bool
StateType::List( CommandInterpreter& inInterpreter )
{
  Lock lock( inInterpreter.StateMachine() );
  inInterpreter.Out() << GetState( inInterpreter );
  return true;
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:7,代码来源:StateTypes.cpp

示例5: bciexception

bool
LineType::Read( CommandInterpreter& inInterpreter )
{
  string line;
  if( !inInterpreter.ReadLine( line ) )
    throw bciexception( "No input associated with command interpreter of type " << ClassName( typeid( inInterpreter ) ) );
  inInterpreter.Out() << line;
  return true;
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:9,代码来源:LineType.cpp

示例6: bciexception

bool
DirectoryType::Rename( CommandInterpreter& inInterpreter )
{
  string dir = inInterpreter.GetToken(),
         newName = inInterpreter.GetToken();
  if( !FileUtils::IsDirectory( dir ) )
    throw bciexception( "There is no directory named \"" << dir << "\"" );
  if( !FileUtils::Rename( dir, newName ) )
    throw bciexception( "Could not rename \"" << dir << "\" to \"" << newName << "\"" );
  return true;
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:11,代码来源:FileSystemTypes.cpp

示例7: ListDirectory

bool
DirectoryType::List( CommandInterpreter& inInterpreter )
{
  string args;
#if _WIN32
  args = "/n ";
#else
  args = "-l ";
#endif
  string remainder = inInterpreter.GetRemainingTokens();
  args += remainder;
  inInterpreter.Out() << ListDirectory( args );
  return true;
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:14,代码来源:FileSystemTypes.cpp

示例8: GetDescription

void
Property::DumpDescription (CommandInterpreter &interpreter,
                           Stream &strm,
                           uint32_t output_width,
                           bool display_qualified_name) const
{
    if (m_value_sp)
    {
        const char *desc = GetDescription();

        if (desc)
        {
            StreamString qualified_name;
            const OptionValueProperties *sub_properties = m_value_sp->GetAsProperties();
            if (sub_properties)
            {
                strm.EOL();
                
                if (m_value_sp->DumpQualifiedName(qualified_name))
                    strm.Printf("'%s' variables:\n\n", qualified_name.GetString().c_str());
                sub_properties->DumpAllDescriptions(interpreter, strm);
            }
            else
            {
                if (desc)
                {
                    if (display_qualified_name)
                    {
                        StreamString qualified_name;
                        DumpQualifiedName(qualified_name);
                        interpreter.OutputFormattedHelpText (strm,
                                                             qualified_name.GetString().c_str(),
                                                             "--",
                                                             desc,
                                                             output_width);
                    }
                    else
                    {
                        interpreter.OutputFormattedHelpText (strm,
                                                             m_name.GetCString(),
                                                             "--",
                                                             desc,
                                                             output_width);
                    }
                }
            }
        }
    }
}
开发者ID:BlueRiverInteractive,项目名称:lldb,代码行数:49,代码来源:Property.cpp

示例9: properties_sp

int
CommandCompletions::SettingsNames (CommandInterpreter &interpreter,
                                   const char *partial_setting_name,
                                   int match_start_point,
                                   int max_return_elements,
                                   SearchFilter *searcher,
                                   bool &word_complete,
                                   StringList &matches)
{
    // Cache the full setting name list
    static StringList g_property_names;
    if (g_property_names.GetSize() == 0)
    {
        // Generate the full setting name list on demand
        lldb::OptionValuePropertiesSP properties_sp (interpreter.GetDebugger().GetValueProperties());
        if (properties_sp)
        {
            StreamString strm;
            properties_sp->DumpValue(nullptr, strm, OptionValue::eDumpOptionName);
            const std::string &str = strm.GetString();
            g_property_names.SplitIntoLines(str.c_str(), str.size());
        }
    }
    
    size_t exact_matches_idx = SIZE_MAX;
    const size_t num_matches = g_property_names.AutoComplete (partial_setting_name, matches, exact_matches_idx);
    word_complete = exact_matches_idx != SIZE_MAX;
    return num_matches;
}
开发者ID:32bitmicro,项目名称:riscv-lldb,代码行数:29,代码来源:CommandCompletions.cpp

示例10: exe_ctx

bool
OptionGroupFormat::ParserGDBFormatLetter (CommandInterpreter &interpreter, char format_letter, Format &format, uint32_t &byte_size)
{
    m_has_gdb_format = true;
    switch (format_letter)
    {
        case 'o': format = eFormatOctal;        m_prev_gdb_format = format_letter; return true; 
        case 'x': format = eFormatHex;          m_prev_gdb_format = format_letter; return true;
        case 'd': format = eFormatDecimal;      m_prev_gdb_format = format_letter; return true;
        case 'u': format = eFormatUnsigned;     m_prev_gdb_format = format_letter; return true;
        case 't': format = eFormatBinary;       m_prev_gdb_format = format_letter; return true;
        case 'f': format = eFormatFloat;        m_prev_gdb_format = format_letter; return true;
        case 'a': format = eFormatAddressInfo;
        {
            ExecutionContext exe_ctx(interpreter.GetExecutionContext());
            Target *target = exe_ctx.GetTargetPtr();
            if (target)
                byte_size = target->GetArchitecture().GetAddressByteSize();
            m_prev_gdb_format = format_letter;
            return true;
        }
        case 'i': format = eFormatInstruction;  m_prev_gdb_format = format_letter; return true;
        case 'c': format = eFormatChar;         m_prev_gdb_format = format_letter; return true;
        case 's': format = eFormatCString;      m_prev_gdb_format = format_letter; return true;
        case 'T': format = eFormatOSType;       m_prev_gdb_format = format_letter; return true;
        case 'A': format = eFormatHexFloat;     m_prev_gdb_format = format_letter; return true;
        case 'b': byte_size = 1;                m_prev_gdb_size = format_letter;   return true;
        case 'h': byte_size = 2;                m_prev_gdb_size = format_letter;   return true;
        case 'w': byte_size = 4;                m_prev_gdb_size = format_letter;   return true;
        case 'g': byte_size = 8;                m_prev_gdb_size = format_letter;   return true;
        default:  break;
    }
    return false;
}
开发者ID:BlueRiverInteractive,项目名称:lldb,代码行数:34,代码来源:OptionGroupFormat.cpp

示例11: completer

int
CommandCompletions::SourceFiles(CommandInterpreter &interpreter,
                                const char *partial_file_name,
                                int match_start_point,
                                int max_return_elements,
                                SearchFilter *searcher,
                                bool &word_complete,
                                StringList &matches)
{
    word_complete = true;
    // Find some way to switch "include support files..."
    SourceFileCompleter completer (interpreter,
                                   false, 
                                   partial_file_name, 
                                   match_start_point, 
                                   max_return_elements,
                                   matches);

    if (searcher == nullptr)
    {
        lldb::TargetSP target_sp = interpreter.GetDebugger().GetSelectedTarget();
        SearchFilterForUnconstrainedSearches null_searcher (target_sp);
        completer.DoCompletion (&null_searcher);
    }
    else
    {
        completer.DoCompletion (searcher);
    }
    return matches.GetSize();
}
开发者ID:32bitmicro,项目名称:riscv-lldb,代码行数:30,代码来源:CommandCompletions.cpp

示例12: completer

int
CommandCompletions::Symbols 
(
    CommandInterpreter &interpreter,
    const char *partial_file_name,
    int match_start_point,
    int max_return_elements,
    SearchFilter *searcher,
    bool &word_complete,
    StringList &matches)
{
    word_complete = true;
    SymbolCompleter completer (interpreter,
                               partial_file_name, 
                               match_start_point, 
                               max_return_elements, 
                               matches);

    if (searcher == NULL)
    {
        lldb::TargetSP target_sp = interpreter.GetDebugger().GetSelectedTarget();
        SearchFilterForUnconstrainedSearches null_searcher (target_sp);
        completer.DoCompletion (&null_searcher);
    }
    else
    {
        completer.DoCompletion (searcher);
    }
    return matches.GetSize();
}
开发者ID:BlueRiverInteractive,项目名称:lldb,代码行数:30,代码来源:CommandCompletions.cpp

示例13: SettingsNames

int CommandCompletions::SettingsNames(CommandInterpreter &interpreter,
                                      CompletionRequest &request,
                                      SearchFilter *searcher) {
  // Cache the full setting name list
  static StringList g_property_names;
  if (g_property_names.GetSize() == 0) {
    // Generate the full setting name list on demand
    lldb::OptionValuePropertiesSP properties_sp(
        interpreter.GetDebugger().GetValueProperties());
    if (properties_sp) {
      StreamString strm;
      properties_sp->DumpValue(nullptr, strm, OptionValue::eDumpOptionName);
      const std::string &str = strm.GetString();
      g_property_names.SplitIntoLines(str.c_str(), str.size());
    }
  }

  size_t exact_matches_idx = SIZE_MAX;
  StringList matches;
  g_property_names.AutoComplete(request.GetCursorArgumentPrefix(), matches,
                                exact_matches_idx);
  request.SetWordComplete(exact_matches_idx != SIZE_MAX);
  request.AddCompletions(matches);
  return request.GetNumberOfMatches();
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:25,代码来源:CommandCompletions.cpp

示例14:

void
OptionGroupValueObjectDisplay::OptionParsingStarting (CommandInterpreter &interpreter)
{
    // If these defaults change, be sure to modify AnyOptionWasSet().
    show_types        = false;
    no_summary_depth  = 0;
    show_location     = false;
    flat_output       = false;
    use_objc          = false;
    max_depth         = UINT32_MAX;
    ptr_depth         = 0;
    use_synth         = true;
    be_raw            = false;
    ignore_cap        = false;
    run_validator     = false;
    
    Target *target = interpreter.GetExecutionContext().GetTargetPtr();
    if (target != nullptr)
        use_dynamic = target->GetPreferDynamicValue();
    else
    {
        // If we don't have any targets, then dynamic values won't do us much good.
        use_dynamic = lldb::eNoDynamicValues;
    }
}
开发者ID:CODECOMMUNITY,项目名称:swift-lldb,代码行数:25,代码来源:OptionGroupValueObjectDisplay.cpp

示例15: iss

bool
StateType::Insert( CommandInterpreter& inInterpreter )
{
  string name = inInterpreter.GetToken();
  string line = inInterpreter.GetRemainder(),
         stateline = name + " " + line + " 0 0";
  State state;
  istringstream iss( stateline );
  if( !( iss >> state ) )
    throw bciexception( "Invalid state definition" );
  {
    Lock lock( inInterpreter.StateMachine() );
    switch( inInterpreter.StateMachine().SystemState() )
    {
      case StateMachine::Idle:
      case StateMachine::WaitingForConnection:
      case StateMachine::Publishing:
      case StateMachine::Information:
        break;
      default:
        throw bciexception( "Could not add state " << name << " to list after information phase" );
    }
    inInterpreter.StateMachine().States().Add( state );
  }
  inInterpreter.StateMachine().ExecuteCallback( BCI_OnState, stateline.c_str() );
  inInterpreter.Log() << "Added state " << name << " to list";
  return true;
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:28,代码来源:StateTypes.cpp


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