polserver/pol-core/pol/cmdlevel.h
Fernando Rozenblit 70b9c1305c
Add maximum cmdlevel to polsys::ListTextCommands() (#231)
The default, -1, will return all commands as before. No need for a version bump because the method checks the number of arguments.
2020-08-19 07:19:30 +02:00

66 lines
1.3 KiB
C++

/** @file
*
* @par History
*/
#ifndef __CMDLEVEL_H
#define __CMDLEVEL_H
#include <memory>
#include <string>
#include <vector>
namespace Pol
{
namespace Bscript
{
class ObjArray;
class BDictionary;
} // namespace Bscript
namespace Clib
{
class ConfigElem;
}
namespace Plib
{
class Package;
}
namespace Core
{
class CmdLevel
{
public:
CmdLevel( Clib::ConfigElem& elem, int cmdlevelnum );
size_t estimateSize() const;
bool matches( const std::string& name ) const;
void add_searchdir( Plib::Package* pkg, const std::string& dir );
void add_searchdir_front( Plib::Package* pkg, const std::string& dir );
std::string name;
unsigned char cmdlevel;
struct SearchDir
{
Plib::Package* pkg;
std::string dir;
};
typedef std::vector<SearchDir> SearchList;
SearchList searchlist;
typedef std::vector<std::string> Aliases;
Aliases aliases;
};
CmdLevel* find_cmdlevel( const char* name );
CmdLevel* FindCmdLevelByAlias( const std::string& str );
std::unique_ptr<Bscript::BDictionary> ListAllCommandsInPackage( Plib::Package* m_pkg,
int max_cmdlevel = -1 );
std::unique_ptr<Bscript::ObjArray> ListCommandsInPackageAtCmdlevel( Plib::Package* m_pkg,
int cmdlvl_num );
} // namespace Core
} // namespace Pol
#endif