lint: All superclasses must be public

This commit is contained in:
MonsterDruide1 2024-04-15 22:23:50 +02:00
parent d6a1d6e82c
commit fd75495c31
9 changed files with 25 additions and 11 deletions

View file

@ -33,7 +33,7 @@ class IUseAudioKeeper;
class CameraRailHolder;
class NameToCameraParamTransferFunc;
class CameraDirector : public HioNode, IUseExecutor {
class CameraDirector : public HioNode, public IUseExecutor {
public:
CameraDirector(s32 maxCameras);
virtual ~CameraDirector();

View file

@ -37,7 +37,7 @@ private:
};
template <class T>
class DeriveActorGroup : LiveActorGroup {
class DeriveActorGroup : public LiveActorGroup {
public:
s32 registerActor(T* actor) { LiveActorGroup::registerActor(actor); }
void removeActor(const T* actor) { LiveActorGroup::removeActor(actor); }

View file

@ -5,5 +5,5 @@
#include "Library/Scene/ISceneObj.h"
namespace al {
class GameDataHolderBase : public ISceneObj, HioNode, IUseMessageSystem {};
class GameDataHolderBase : public ISceneObj, public HioNode, public IUseMessageSystem {};
} // namespace al

View file

@ -15,7 +15,7 @@ namespace al {
class SceneCameraInfo;
class ScreenCapture;
class ScreenCaptureExecutor : IUseHioNode {
class ScreenCaptureExecutor : public IUseHioNode {
public:
ScreenCaptureExecutor(s32);
~ScreenCaptureExecutor();

View file

@ -17,7 +17,7 @@ class PlayGuideCamera;
class PlayGuideBgm;
class MapMini;
class StageSceneLayout : al::NerveStateBase {
class StageSceneLayout : public al::NerveStateBase {
public:
StageSceneLayout(const char*, const al::LayoutInitInfo&, const al::PlayerHolder*,
const al::SubCameraRenderer*);

View file

@ -2,7 +2,7 @@
#include "Library/LiveActor/LiveActor.h"
class WorldMapEarth : al::LiveActor {
class WorldMapEarth : public al::LiveActor {
public:
WorldMapEarth(const char* name);
void init(const al::ActorInitInfo& initInfo) override;

View file

@ -3,7 +3,7 @@
#include "Library/HostIO/HioNode.h"
#include "Library/Yaml/ByamlIter.h"
class PlayerConst : al::HioNode {
class PlayerConst : public al::HioNode {
public:
PlayerConst();
PlayerConst(const al::ByamlIter&);

View file

@ -12,7 +12,7 @@ class PlayerPainPartsKeeper;
class PlayerCostumeInfo;
class IUseDimension;
class PlayerModelChangerHakoniwa : IPlayerModelChanger, al::HioNode {
class PlayerModelChangerHakoniwa : public IPlayerModelChanger, public al::HioNode {
public:
PlayerModelChangerHakoniwa(const al::LiveActor*, PlayerModelHolder*, PlayerPainPartsKeeper*,
PlayerCostumeInfo*, const IUseDimension*);

View file

@ -192,11 +192,12 @@ def header_sorted_visibility(c, path):
if line.endswith("\\"): line = line[0:-1]
line = line.strip()
if line not in visibilities_ordered:
header_check_line(line, path, nest_level[-1])
header_check_line(line, path, nest_level[-1], should_start_class)
if "{" in line and "}" in line:
if CHECK(lambda a:a.count("{")==a.count("}") or (a.startswith("{") and a.endswith("}};")), line, "Unbalanced \"{\" and \"}\" in the same line! (exception: end of brace-initialized array)", path): return
if line.startswith("{") and line.endswith("}};"):
del nest_level[-1]
should_start_class = False
continue
if line.startswith("class ") and not line.endswith(";"):
@ -221,9 +222,22 @@ def header_sorted_visibility(c, path):
print("nest_level", nest_level)
exit(1)
def header_check_line(line, path, visibility):
def header_check_line(line, path, visibility, should_start_class):
if visibility == -2: # outside of class/struct/...
pass
if (line.startswith("class") and (not line.endswith(";") or "{" in line)) or should_start_class:
if ": " in line and not ": public" in line and not ": virtual public" in line:
FAIL("All superclasses must be public!", line, path)
if should_start_class and not ": " in line and not line.startswith("public") and not line.startswith("virtual public"):
FAIL("All superclasses must be public!", line, path)
if line.startswith("class") and "{" in line and ": " in line:
index = 0
while index < len(line):
index = line.find(",", index+1)
if index == -1: break
if index < line.find(": "): continue
if index != line.find(", public", index) and index != line.find(", virtual public", index):
FAIL("All superclasses must be public!", line, path)
elif visibility == -1: # inside class, but not in a visibility block
allowed = line in ["", "};"] or line.startswith("SEAD_SINGLETON_DISPOSER") or line.startswith("SEAD_RTTI_BASE") or line.startswith("SEAD_RTTI_OVERRIDE")
CHECK(lambda a:allowed, line, "Inside class, but not in a visibility block, only empty lines and closing brace allowed!", path)