1 // =================================
 2 // Copyright (c) 2021 Seppo Laakko
 3 // Distributed under the MIT license
 4 // =================================
 5 
 6 #ifndef CMAJOR_SYMBOLS_STRING_FUNCTIONS_INCLUDED
 7 #define CMAJOR_SYMBOLS_STRING_FUNCTIONS_INCLUDED
 8 #include <cmajor/symbols/TypeSymbol.hpp>
 9 #include <cmajor/symbols/FunctionSymbol.hpp>
10 
11 namespace cmajor { namespace symbols {
12 
13 class StringFunctionContainerSymbol public TypeSymbol
14 {
15 public:
16     StringFunctionContainerSymbol();
17     StringFunctionContainerSymbol(const Span& span_const boost::uuids::uuid& sourceModuleId_const std::u32string& name_);
18     void* IrType(Emitter& emitter) override;
19     void* CreateDefaultIrValue(Emitter& emitter) override;
20     void Write(SymbolWriter& writer) override;
21     void Read(SymbolReader& reader) override;
22     bool IsStringFunctionContainer() const override { return true; }
23 };
24 
25 class StringLengthFunction public FunctionSymbol
26 {
27 public:
28     StringLengthFunction(TypeSymbol* parentType);
29     StringLengthFunction(const Span& span_const boost::uuids::uuid& sourceModuleId_const std::u32string& name_);
30     void Write(SymbolWriter& writer) override;
31     void Read(SymbolReader& reader) override;
32     void GenerateCall(Emitter& emitterstd::std::vector<GenObject*>&genObjectsOperationFlagsflagsconstSpan&spanconstboost::uuids::uuid& moduleId) override;
33     std::unique_ptr<Value> ConstructValue(const std::std::vector<std::std::unique_ptr<Value>>&argumentValuesconstSpan&spanconstboost::uuids::uuid&moduleIdValue*receiver) const override;
34     bool IsBasicTypeOperation() const override { return true; }
35     bool IsCompileTimePrimitiveFunction() const override { return true; }
36 };
37 
38 } } // namespace cmajor::symbols
39 
40 #endif // CMAJOR_SYMBOLS_STRING_FUNCTIONS_INCLUDED