FCT
载入中...
搜索中...
未找到
PassSource.h
浏览该文件的文档.
1//
2// Created by Administrator on 2025/3/20.
3//
4#include "../ThirdParty.h"
5
6#ifndef ANDROIDTUTORIAL_PASSSOURCE_H
7#define ANDROIDTUTORIAL_PASSSOURCE_H
8
9namespace FCT {
10 struct PassSource {
11 PassSource(const std::string& source) { //不能有多余的空格,为了效率,并没有额外处理空格
12 size_t dotPos = source.find('.');
13 if (dotPos != std::string::npos) {
14 oper = source.substr(0, dotPos);
15 name = source.substr(dotPos + 1);
16 } else {
17 name = source;
18 }
19 }
20
21 PassSource(const std::string& oper, const std::string& name)
22 : oper(oper), name(name) {}
23
24 PassSource operator|(const PassSource& rhs) const {
25 PassSource result = *this;
26 result.alternatives.push_back(rhs);
27 return result;
28 }
29
30 const std::string& getName() const { return name; }
31
32 const std::string& getOperator() const { return oper; }
33
34 const std::vector<PassSource>& getAlternatives() const { return alternatives; }
35
36 bool hasAlternatives() const { return !alternatives.empty(); }
37
38 std::string getFullIdentifier() const {
39 return oper.empty() ? name : (oper + "." + name);
40 }
41
42 std::string toString() const {
43 std::string result = getFullIdentifier();
44 for (const auto& alt : alternatives) {
45 result += " | " + alt.getFullIdentifier();
46 }
47 return result;
48 }
49
50 std::string name;
51 std::string oper;
52 std::vector<PassSource> alternatives;
53 };
54}
55
56#endif //ANDROIDTUTORIAL_PASSSOURCE_H
std::string toString() const
PassSource(const std::string &oper, const std::string &name)
std::vector< PassSource > alternatives
const std::string & getOperator() const
const std::string & getName() const
std::string getFullIdentifier() const
PassSource operator|(const PassSource &rhs) const
bool hasAlternatives() const
PassSource(const std::string &source)
const std::vector< PassSource > & getAlternatives() const