Crossfire Server, Trunk
pyi-generate.cpp File Reference
#include <fstream>
#include "include/cfpython.h"
+ Include dependency graph for pyi-generate.cpp:

Go to the source code of this file.

Data Structures

struct  methodSignature
 
struct  propertySignature
 

Functions

const methodSignaturegetSignature (const methodSignature *signatures, const char *method)
 
const propertySignaturegetSignature (const propertySignature *properties, const char *property)
 
int main (int, char **)
 
void writeClass (std::ofstream &pyi, const char *name, const PyTypeObject *obj, const methodSignature *methods, const propertySignature *properties, const char *base=nullptr)
 
void writeConstants (std::ofstream &pyi, const CFConstant *constants)
 
void writeDescriptionAndBody (std::ofstream &pyi, const char *indent, const char *description)
 
void writeEnum (std::ofstream &pyi, const char *name, const CFConstant *constants)
 
void writeMethods (std::ofstream &pyi, const PyMethodDef method[], const methodSignature *signatures, bool inClass)
 

Variables

static const methodSignature archMethods []
 
static const propertySignature archProperties []
 
static const methodSignature mapMethods []
 
static const propertySignature mapProperties []
 
static const methodSignature moduleMethods []
 
static const methodSignature objectMethods []
 
static const propertySignature objectProperties []
 
static const methodSignature partyMethods []
 
static const propertySignature partyProperties []
 
static const methodSignature playerMethods []
 
static const propertySignature playerProperties []
 
static const methodSignature regionMethods []
 
static const propertySignature regionProperties []
 
static methodSignature unknown = { nullptr, nullptr, "any", nullptr }
 
static propertySignature unknownProperty = { nullptr, "any", nullptr }
 

Function Documentation

◆ getSignature() [1/2]

const methodSignature* getSignature ( const methodSignature signatures,
const char *  method 
)

Definition at line 72 of file pyi-generate.cpp.

References methodSignature::method, and unknown.

Referenced by writeClass(), and writeMethods().

+ Here is the caller graph for this function:

◆ getSignature() [2/2]

const propertySignature* getSignature ( const propertySignature properties,
const char *  property 
)

Definition at line 106 of file pyi-generate.cpp.

References properties, and unknownProperty.

◆ main()

◆ writeClass()

void writeClass ( std::ofstream &  pyi,
const char *  name,
const PyTypeObject *  obj,
const methodSignature methods,
const propertySignature properties,
const char *  base = nullptr 
)

Definition at line 115 of file pyi-generate.cpp.

References getSignature(), give::name, properties, writeDescriptionAndBody(), and writeMethods().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeConstants()

void writeConstants ( std::ofstream &  pyi,
const CFConstant constants 
)

Definition at line 148 of file pyi-generate.cpp.

References c, CFConstant::name, and CFConstant::value.

Referenced by main().

+ Here is the caller graph for this function:

◆ writeDescriptionAndBody()

void writeDescriptionAndBody ( std::ofstream &  pyi,
const char *  indent,
const char *  description 
)

Definition at line 81 of file pyi-generate.cpp.

Referenced by writeClass(), and writeMethods().

+ Here is the caller graph for this function:

◆ writeEnum()

void writeEnum ( std::ofstream &  pyi,
const char *  name,
const CFConstant constants 
)

Definition at line 140 of file pyi-generate.cpp.

References c, give::name, CFConstant::name, and CFConstant::value.

Referenced by main().

+ Here is the caller graph for this function:

◆ writeMethods()

void writeMethods ( std::ofstream &  pyi,
const PyMethodDef  method[],
const methodSignature signatures,
bool  inClass 
)

Definition at line 89 of file pyi-generate.cpp.

References getSignature(), m, and writeDescriptionAndBody().

Referenced by main(), and writeClass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ archMethods

const methodSignature archMethods[]
static
Initial value:
= {
{ nullptr, nullptr, nullptr, nullptr },
}

Definition at line 65 of file pyi-generate.cpp.

Referenced by main().

◆ archProperties

const propertySignature archProperties[]
static
Initial value:
= {
{ nullptr, nullptr, nullptr },
}

Definition at line 68 of file pyi-generate.cpp.

Referenced by main().

◆ mapMethods

const methodSignature mapMethods[]
static
Initial value:
= {
{ nullptr, nullptr, nullptr, nullptr },
}

Definition at line 51 of file pyi-generate.cpp.

Referenced by main().

◆ mapProperties

const propertySignature mapProperties[]
static
Initial value:
= {
{ nullptr, nullptr, nullptr },
}

Definition at line 54 of file pyi-generate.cpp.

Referenced by main().

◆ moduleMethods

const methodSignature moduleMethods[]
static
Initial value:
= {
{ "FindPlayer", "name: str", "Player", "Find the specified player from its name.\n:param name Player's name, case-sensitive.\n:return Player, None if no player matches." },
{ nullptr, nullptr, nullptr, nullptr },
}

Definition at line 23 of file pyi-generate.cpp.

Referenced by main().

◆ objectMethods

const methodSignature objectMethods[]
static
Initial value:
= {
{ "WriteKey", "key: str, value: str, add_key: int=0", "bool", "Add a key with the specified value to the object.\n:param key Key name.\n:param value Value to give the key.\n:param add_key If 1 then the key is set, if 0 then the key is only updated if it exists.\n:return True if the key was added or updated, False else." },
{ nullptr, nullptr, nullptr, nullptr },
}

Definition at line 28 of file pyi-generate.cpp.

Referenced by main().

◆ objectProperties

const propertySignature objectProperties[]
static
Initial value:
= {
{ nullptr, nullptr, nullptr },
}

Definition at line 32 of file pyi-generate.cpp.

Referenced by main().

◆ partyMethods

const methodSignature partyMethods[]
static
Initial value:
= {
{ nullptr, nullptr, nullptr, nullptr },
}

Definition at line 58 of file pyi-generate.cpp.

Referenced by main().

◆ partyProperties

const propertySignature partyProperties[]
static
Initial value:
= {
{ nullptr, nullptr, nullptr },
}

Definition at line 61 of file pyi-generate.cpp.

Referenced by main().

◆ playerMethods

const methodSignature playerMethods[]
static
Initial value:
= {
{ nullptr, nullptr, nullptr, nullptr },
}

Definition at line 36 of file pyi-generate.cpp.

Referenced by main().

◆ playerProperties

const propertySignature playerProperties[]
static
Initial value:
= {
{ "MarkedItem", "Object", "Marked item, used by some actions." },
{ nullptr, nullptr, nullptr },
}

Definition at line 39 of file pyi-generate.cpp.

Referenced by main().

◆ regionMethods

const methodSignature regionMethods[]
static
Initial value:
= {
{ nullptr, nullptr, nullptr, nullptr },
}

Definition at line 44 of file pyi-generate.cpp.

Referenced by main().

◆ regionProperties

const propertySignature regionProperties[]
static
Initial value:
= {
{ nullptr, nullptr, nullptr },
}

Definition at line 47 of file pyi-generate.cpp.

Referenced by main().

◆ unknown

methodSignature unknown = { nullptr, nullptr, "any", nullptr }
static

Definition at line 20 of file pyi-generate.cpp.

Referenced by getSignature().

◆ unknownProperty

propertySignature unknownProperty = { nullptr, "any", nullptr }
static

Definition at line 21 of file pyi-generate.cpp.

Referenced by getSignature().