HaikuDepot: Custom List Removal
Remove use of custom list class in the python- generated model classes for interaction with HDS; use STL container classes instead. Relates To #15534 Change-Id: Ib8f4942b55859c1af38da816591e911174ba52ea Reviewed-on: https://review.haiku-os.org/c/haiku/+/2957 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
parent
43def5e333
commit
dc8d6e73f8
@ -20,7 +20,7 @@ JSON_TYPE_NUMBER = "number"
|
|||||||
|
|
||||||
# The possible C++ types
|
# The possible C++ types
|
||||||
CPP_TYPE_STRING = "BString"
|
CPP_TYPE_STRING = "BString"
|
||||||
CPP_TYPE_ARRAY = "List"
|
CPP_TYPE_ARRAY = "BObjectList"
|
||||||
CPP_TYPE_BOOLEAN = "bool"
|
CPP_TYPE_BOOLEAN = "bool"
|
||||||
CPP_TYPE_INTEGER = "int64"
|
CPP_TYPE_INTEGER = "int64"
|
||||||
CPP_TYPE_NUMBER = "double"
|
CPP_TYPE_NUMBER = "double"
|
||||||
@ -75,7 +75,7 @@ def propmetadatatocpptypename(propmetadata):
|
|||||||
if not itemsjavatype or 0 == len(itemsjavatype):
|
if not itemsjavatype or 0 == len(itemsjavatype):
|
||||||
raise Exception('missing "javaType" field')
|
raise Exception('missing "javaType" field')
|
||||||
|
|
||||||
return "%s <%s*, true>" % (CPP_TYPE_ARRAY, javatypetocppname(itemsjavatype))
|
return "%s <%s>" % (CPP_TYPE_ARRAY, javatypetocppname(itemsjavatype))
|
||||||
|
|
||||||
raise Exception('unknown json-schema type [' + type + ']')
|
raise Exception('unknown json-schema type [' + type + ']')
|
||||||
|
|
||||||
|
@ -38,15 +38,15 @@ void
|
|||||||
${cppclassname}::AddTo${cppname}(${cppcontainertype}* value)
|
${cppclassname}::AddTo${cppname}(${cppcontainertype}* value)
|
||||||
{
|
{
|
||||||
if (${cppmembername} == NULL)
|
if (${cppmembername} == NULL)
|
||||||
${cppmembername} = new List<${cppcontainertype}*, true>();
|
${cppmembername} = new BObjectList<${cppcontainertype}>();
|
||||||
${cppmembername}->Add(value);
|
${cppmembername}->AddItem(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
${cppclassname}::Set${cppname}(List<${cppcontainertype}*, true>* value)
|
${cppclassname}::Set${cppname}(BObjectList<${cppcontainertype}>* value)
|
||||||
{
|
{
|
||||||
${cppmembername} = value;
|
${cppmembername} = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ def writelistaccessorsheader(outputfile, cppname, cppcontainertype):
|
|||||||
|
|
||||||
outputfile.write(
|
outputfile.write(
|
||||||
string.Template(""" void AddTo${cppname}(${cppcontainertype}* value);
|
string.Template(""" void AddTo${cppname}(${cppcontainertype}* value);
|
||||||
void Set${cppname}(List<${cppcontainertype}*, true>* value);
|
void Set${cppname}(BObjectList<${cppcontainertype}>* value);
|
||||||
int32 Count${cppname}();
|
int32 Count${cppname}();
|
||||||
${cppcontainertype}* ${cppname}ItemAt(int32 index);
|
${cppcontainertype}* ${cppname}ItemAt(int32 index);
|
||||||
bool ${cppname}IsNull();
|
bool ${cppname}IsNull();
|
||||||
@ -336,7 +336,7 @@ def schematocppmodels(inputfile, schema, outputdirectory):
|
|||||||
#ifndef ${guarddefname}
|
#ifndef ${guarddefname}
|
||||||
#define ${guarddefname}
|
#define ${guarddefname}
|
||||||
|
|
||||||
#include "List.h"
|
#include <ObjectList.h>
|
||||||
#include "String.h"
|
#include "String.h"
|
||||||
|
|
||||||
""").substitute({'guarddefname': guarddefname}))
|
""").substitute({'guarddefname': guarddefname}))
|
||||||
|
@ -442,11 +442,11 @@ public:
|
|||||||
bool Handle(const BJsonEvent& event);
|
bool Handle(const BJsonEvent& event);
|
||||||
|
|
||||||
|
|
||||||
List<${subtype_cppmodelclassname}*, true>* Target(); // list of %s pointers
|
BObjectList<${subtype_cppmodelclassname}>* Target(); // list of %s pointers
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
List<${subtype_cppmodelclassname}*, true>* fTarget;
|
BObjectList<${subtype_cppmodelclassname}>* fTarget;
|
||||||
};
|
};
|
||||||
""").substitute(jscom.uniondicts(naming.todict(), subtypenaming.todict())))
|
""").substitute(jscom.uniondicts(naming.todict(), subtypenaming.todict())))
|
||||||
|
|
||||||
@ -758,7 +758,7 @@ ${subtype_cppstackedlistlistenerclassname}::${subtype_cppstackedlistlistenerclas
|
|||||||
:
|
:
|
||||||
${cppsuperstackedlistenerclassname}(mainListener, parent)
|
${cppsuperstackedlistenerclassname}(mainListener, parent)
|
||||||
{
|
{
|
||||||
fTarget = new List<${subtype_cppmodelclassname}*, true>();
|
fTarget = new BObjectList<${subtype_cppmodelclassname}>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -767,7 +767,7 @@ ${subtype_cppstackedlistlistenerclassname}::~${subtype_cppstackedlistlistenercla
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List<${subtype_cppmodelclassname}*, true>*
|
BObjectList<${subtype_cppmodelclassname}>*
|
||||||
${subtype_cppstackedlistlistenerclassname}::Target()
|
${subtype_cppstackedlistlistenerclassname}::Target()
|
||||||
{
|
{
|
||||||
return fTarget;
|
return fTarget;
|
||||||
@ -792,7 +792,7 @@ ${subtype_cppstackedlistlistenerclassname}::Handle(const BJsonEvent& event)
|
|||||||
{
|
{
|
||||||
${subtype_cppstackedlistenerclassname}* nextListener =
|
${subtype_cppstackedlistenerclassname}* nextListener =
|
||||||
new ${subtype_cppstackedlistenerclassname}(fMainListener, this);
|
new ${subtype_cppstackedlistenerclassname}(fMainListener, this);
|
||||||
fTarget->Add(nextListener->Target());
|
fTarget->AddItem(nextListener->Target());
|
||||||
Push(nextListener);
|
Push(nextListener);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1164,8 +1164,9 @@ def schematocppparser(inputfile, schema, outputdirectory, supportbulkcontainer):
|
|||||||
""").substitute({'guarddefname': guarddefname}))
|
""").substitute({'guarddefname': guarddefname}))
|
||||||
|
|
||||||
cpphfile.write(
|
cpphfile.write(
|
||||||
string.Template("""
|
string.Template("""
|
||||||
#include <JsonEventListener.h>
|
#include <JsonEventListener.h>
|
||||||
|
#include <ObjectList.h>
|
||||||
|
|
||||||
#include "${cpprootmodelclassname}.h"
|
#include "${cpprootmodelclassname}.h"
|
||||||
|
|
||||||
@ -1272,7 +1273,7 @@ private:
|
|||||||
istate = CppParserImplementationState(cppifile, naming)
|
istate = CppParserImplementationState(cppifile, naming)
|
||||||
jscom.writetopcomment(cppifile, os.path.split(inputfile)[1], 'Listener')
|
jscom.writetopcomment(cppifile, os.path.split(inputfile)[1], 'Listener')
|
||||||
cppifile.write('#include "%s"\n' % cppheaderleafname)
|
cppifile.write('#include "%s"\n' % cppheaderleafname)
|
||||||
cppifile.write('#include "List.h"\n\n')
|
cppifile.write('#include <ObjectList.h>\n\n')
|
||||||
cppifile.write('#include <stdio.h>\n\n')
|
cppifile.write('#include <stdio.h>\n\n')
|
||||||
|
|
||||||
cppifile.write('// #pragma mark - private interfaces for the stacked listeners\n\n')
|
cppifile.write('// #pragma mark - private interfaces for the stacked listeners\n\n')
|
||||||
|
Loading…
Reference in New Issue
Block a user