Update release

This commit is contained in:
vczh
2023-04-09 03:49:54 -07:00
parent 5d28616d53
commit 2627b8e659
31 changed files with 29157 additions and 29918 deletions
-7
View File
@@ -3067,13 +3067,6 @@ WindowsDirect2DParagraph
TextRange(){} TextRange(){}
TextRange(vint _start, vint _end):start(_start),end(_end){} TextRange(vint _start, vint _end):start(_start),end(_end){}
inline vint Compare(const TextRange& value)const
{
vint result;
if ((result = start - value.start) != 0) return result;
if ((result = end - value.end) != 0) return result;
return 0;
}
GUI_DEFINE_COMPARE_OPERATORS(TextRange) GUI_DEFINE_COMPARE_OPERATORS(TextRange)
}; };
+1 -16
View File
@@ -461,8 +461,7 @@ Renderers
ColorItemResource selectedFocused; ColorItemResource selectedFocused;
ColorItemResource selectedUnfocused; ColorItemResource selectedUnfocused;
bool operator==(const ColorEntryResource& value){return false;} bool operator==(const ColorEntryResource& value) const { return false; }
bool operator!=(const ColorEntryResource& value){return true;}
}; };
typedef collections::Array<ColorEntryResource> ColorArray; typedef collections::Array<ColorEntryResource> ColorArray;
@@ -1057,13 +1056,6 @@ UniscribeColor
UniscribeColorRange(){} UniscribeColorRange(){}
UniscribeColorRange(vint _start, vint _end):start(_start),end(_end){} UniscribeColorRange(vint _start, vint _end):start(_start),end(_end){}
inline vint Compare(const UniscribeColorRange& value)const
{
vint result;
if ((result = start - value.start) != 0) return result;
if ((result = end - value.end) != 0) return result;
return 0;
}
GUI_DEFINE_COMPARE_OPERATORS(UniscribeColorRange) GUI_DEFINE_COMPARE_OPERATORS(UniscribeColorRange)
}; };
@@ -1075,13 +1067,6 @@ UniscribeColor
UniscribeColor(){} UniscribeColor(){}
UniscribeColor(Color _fontColor, Color _backgroundColor):fontColor(_fontColor),backgroundColor(_backgroundColor){} UniscribeColor(Color _fontColor, Color _backgroundColor):fontColor(_fontColor),backgroundColor(_backgroundColor){}
inline vint64_t Compare(const UniscribeColor& value)const
{
vint64_t result;
if ((result = fontColor.Compare(value.fontColor)) != 0) return result;
if ((result = backgroundColor.Compare(value.backgroundColor)) != 0) return result;
return 0;
}
GUI_DEFINE_COMPARE_OPERATORS(UniscribeColor) GUI_DEFINE_COMPARE_OPERATORS(UniscribeColor)
}; };
} }
+359 -225
View File
File diff suppressed because it is too large Load Diff
+50 -153
View File
@@ -74,12 +74,8 @@ Enumerations
}; };
#define GUI_DEFINE_COMPARE_OPERATORS(TYPE)\ #define GUI_DEFINE_COMPARE_OPERATORS(TYPE)\
inline bool operator==(const TYPE& right)const { return Compare(right) == 0; } \ std::strong_ordering operator<=>(const TYPE&) const = default;\
inline bool operator!=(const TYPE& right)const { return Compare(right) != 0; } \ bool operator==(const TYPE&) const = default;\
inline bool operator< (const TYPE& right)const { return Compare(right) < 0; } \
inline bool operator<=(const TYPE& right)const { return Compare(right) <= 0; } \
inline bool operator> (const TYPE& right)const { return Compare(right) > 0; } \
inline bool operator>=(const TYPE& right)const { return Compare(right) >= 0; } \
/*********************************************************************** /***********************************************************************
TextPos TextPos
@@ -109,13 +105,6 @@ TextPos
{ {
} }
inline vint Compare(const TextPos& value)const
{
vint result;
if ((result = row - value.row) != 0) return result;
if ((result = column - value.column) != 0) return result;
return 0;
}
GUI_DEFINE_COMPARE_OPERATORS(TextPos) GUI_DEFINE_COMPARE_OPERATORS(TextPos)
}; };
@@ -147,13 +136,6 @@ GridPos
{ {
} }
inline vint Compare(const GridPos& value)const
{
vint result;
if ((result = row - value.row) != 0) return result;
if ((result = column - value.column) != 0) return result;
return 0;
}
GUI_DEFINE_COMPARE_OPERATORS(GridPos) GUI_DEFINE_COMPARE_OPERATORS(GridPos)
}; };
@@ -180,7 +162,6 @@ Coordinate
NativeCoordinate& operator=(const NativeCoordinate& _value) = default; NativeCoordinate& operator=(const NativeCoordinate& _value) = default;
NativeCoordinate& operator=(NativeCoordinate&& _value) = default; NativeCoordinate& operator=(NativeCoordinate&& _value) = default;
inline vint Compare(NativeCoordinate c) const { return value - c.value; }
GUI_DEFINE_COMPARE_OPERATORS(NativeCoordinate) GUI_DEFINE_COMPARE_OPERATORS(NativeCoordinate)
inline NativeCoordinate operator+(NativeCoordinate c)const { return value + c.value; }; inline NativeCoordinate operator+(NativeCoordinate c)const { return value + c.value; };
@@ -227,13 +208,6 @@ Point
{ {
} }
inline vint Compare(const Point_<T>& value)const
{
vint result;
if ((result = CompareCoordinate(x, value.x)) != 0) return result;
if ((result = CompareCoordinate(y, value.y)) != 0) return result;
return 0;
}
GUI_DEFINE_COMPARE_OPERATORS(Point_<T>) GUI_DEFINE_COMPARE_OPERATORS(Point_<T>)
}; };
@@ -270,13 +244,6 @@ Size
{ {
} }
inline vint Compare(const Size_<T>& value)const
{
vint result;
if ((result = CompareCoordinate(x, value.x)) != 0) return result;
if ((result = CompareCoordinate(y, value.y)) != 0) return result;
return 0;
}
GUI_DEFINE_COMPARE_OPERATORS(Size_<T>) GUI_DEFINE_COMPARE_OPERATORS(Size_<T>)
}; };
@@ -326,15 +293,6 @@ Rectangle
{ {
} }
inline vint Compare(const Rect_<T>& value)const
{
vint result;
if ((result = CompareCoordinate(x1, value.x1)) != 0) return result;
if ((result = CompareCoordinate(y1, value.y1)) != 0) return result;
if ((result = CompareCoordinate(x2, value.x2)) != 0) return result;
if ((result = CompareCoordinate(y2, value.y2)) != 0) return result;
return 0;
}
GUI_DEFINE_COMPARE_OPERATORS(Rect_<T>) GUI_DEFINE_COMPARE_OPERATORS(Rect_<T>)
Point_<T> LeftTop()const Point_<T> LeftTop()const
@@ -536,11 +494,8 @@ Color
{ {
} }
vint64_t Compare(Color color)const std::strong_ordering operator<=>(const Color& c) const { return value <=> c.value; }
{ bool operator==(const Color& c) const { return value == c.value; }
return (vint64_t)value - (vint64_t)color.value;
}
GUI_DEFINE_COMPARE_OPERATORS(Color)
static Color Parse(const WString& value) static Color Parse(const WString& value)
{ {
@@ -628,15 +583,6 @@ Margin
{ {
} }
inline vint Compare(const Margin_<T>& value)const
{
vint result;
if ((result = CompareCoordinate(left, value.left)) != 0) return result;
if ((result = CompareCoordinate(top, value.top)) != 0) return result;
if ((result = CompareCoordinate(right, value.right)) != 0) return result;
if ((result = CompareCoordinate(bottom, value.bottom)) != 0) return result;
return 0;
}
GUI_DEFINE_COMPARE_OPERATORS(Margin_<T>) GUI_DEFINE_COMPARE_OPERATORS(Margin_<T>)
}; };
@@ -696,33 +642,6 @@ Resources
{ {
} }
vint64_t Compare(const FontProperties& value)const
{
vint64_t result = 0;
result = WString::Compare(fontFamily, value.fontFamily);
if (result != 0) return result;
result = (vint64_t)size - (vint64_t)value.size;
if (result != 0) return result;
result = (vint64_t)bold - (vint64_t)value.bold;
if (result != 0) return result;
result = (vint64_t)italic - (vint64_t)value.italic;
if (result != 0) return result;
result = (vint64_t)underline - (vint64_t)value.underline;
if (result != 0) return result;
result = (vint64_t)strikeline - (vint64_t)value.strikeline;
if (result != 0) return result;
result = (vint64_t)antialias - (vint64_t)value.antialias;
if (result != 0) return result;
return 0;
}
GUI_DEFINE_COMPARE_OPERATORS(FontProperties) GUI_DEFINE_COMPARE_OPERATORS(FontProperties)
}; };
@@ -2347,7 +2266,12 @@ INativeWindow
/// </summary> /// </summary>
/// <returns>Returns true if the window needs to be updated.</returns> /// <returns>Returns true if the window needs to be updated.</returns>
/// <param name="cleanBeforeRender">True when the whole render target needs to be cleaned.</param> /// <param name="cleanBeforeRender">True when the whole render target needs to be cleaned.</param>
virtual void ForceRefresh(bool handleFailure, bool& failureByResized, bool& failureByLostDevice); virtual void ForceRefresh(bool handleFailure, bool& updated, bool& failureByResized, bool& failureByLostDevice);
/// <summary>
/// Called when the window becomes a main window in hosted mode.
/// This callback is only called once on the main window.
/// </summary>
virtual void BecomeMainHostedWindow();
/// <summary> /// <summary>
/// Called when the window becomes a non-main window in hosted mode. /// Called when the window becomes a non-main window in hosted mode.
/// It requires MaximizedBox and MinimizedBox to be disabled. /// It requires MaximizedBox and MinimizedBox to be disabled.
@@ -3707,6 +3631,10 @@ Predefined Events
ParentLineChanged, ParentLineChanged,
/// <summary>Service added changed.</summary> /// <summary>Service added changed.</summary>
ServiceAdded, ServiceAdded,
/// <summary>The window need to update when data or layout is changed. This even only triggered on <see cref="controls::GuiControlHost"/>.</summary>
UpdateRequested,
/// <summary>The window finished all the updating works after data or layout is changed. This even only triggered on <see cref="controls::GuiControlHost"/>.</summary>
UpdateFullfilled,
}; };
/// <summary>Control signal event arguments.</summary> /// <summary>Control signal event arguments.</summary>
@@ -4018,7 +3946,9 @@ Basic Construction
friend class controls::GuiControl; friend class controls::GuiControl;
friend class GuiGraphicsHost; friend class GuiGraphicsHost;
friend void InvokeOnCompositionStateChanged(compositions::GuiGraphicsComposition* composition); friend void InvokeOnCompositionStateChanged(GuiGraphicsComposition* composition);
friend Size InvokeGetMinPreferredClientSizeInternal(GuiGraphicsComposition* composition, bool considerPreferredMinSize);
friend Rect InvokeGetPreferredBoundsInternal(GuiGraphicsComposition* composition, bool considerPreferredMinSize);
public: public:
/// <summary> /// <summary>
/// Minimum size limitation. /// Minimum size limitation.
@@ -4073,6 +4003,9 @@ Basic Construction
void SetAssociatedControl(controls::GuiControl* control); void SetAssociatedControl(controls::GuiControl* control);
void InvokeOnCompositionStateChanged(); void InvokeOnCompositionStateChanged();
virtual Size GetMinPreferredClientSizeInternal(bool considerPreferredMinSize) = 0;
virtual Rect GetPreferredBoundsInternal(bool considerPreferredMinSize) = 0;
static bool SharedPtrDestructorProc(DescriptableObject* obj, bool forceDisposing); static bool SharedPtrDestructorProc(DescriptableObject* obj, bool forceDisposing);
public: public:
GuiGraphicsComposition(); GuiGraphicsComposition();
@@ -4210,15 +4143,16 @@ Basic Construction
/// <summary>Force to calculate layout and size immediately</summary> /// <summary>Force to calculate layout and size immediately</summary>
virtual void ForceCalculateSizeImmediately(); virtual void ForceCalculateSizeImmediately();
/// <summary>Get the preferred minimum client size.</summary>
/// <returns>The preferred minimum client size.</returns>
Size GetMinPreferredClientSize();
/// <summary>Get the preferred bounds.</summary>
/// <returns>The preferred bounds.</returns>
Rect GetPreferredBounds();
/// <summary>Test is the size calculation affected by the parent.</summary> /// <summary>Test is the size calculation affected by the parent.</summary>
/// <returns>Returns true if the size calculation is affected by the parent.</returns> /// <returns>Returns true if the size calculation is affected by the parent.</returns>
virtual bool IsSizeAffectParent()=0; virtual bool IsSizeAffectParent()=0;
/// <summary>Get the preferred minimum client size.</summary>
/// <returns>The preferred minimum client size.</returns>
virtual Size GetMinPreferredClientSize()=0;
/// <summary>Get the preferred bounds.</summary>
/// <returns>The preferred bounds.</returns>
virtual Rect GetPreferredBounds()=0;
/// <summary>Get the bounds.</summary> /// <summary>Get the bounds.</summary>
/// <returns>The bounds.</returns> /// <returns>The bounds.</returns>
virtual Rect GetBounds()=0; virtual Rect GetBounds()=0;
@@ -4229,15 +4163,18 @@ Basic Construction
/// </summary> /// </summary>
class GuiGraphicsSite : public GuiGraphicsComposition, public Description<GuiGraphicsSite> class GuiGraphicsSite : public GuiGraphicsComposition, public Description<GuiGraphicsSite>
{ {
friend Rect InvokeGetBoundsInternal(GuiGraphicsSite* composition, Rect expectedBounds, bool considerPreferredMinSize);
protected: protected:
Rect previousBounds; Rect previousBounds;
/// <summary>Calculate the final bounds from an expected bounds.</summary> /// <summary>Calculate the final bounds from an expected bounds.</summary>
/// <returns>The final bounds according to some configuration like margin, minimum size, etc..</returns> /// <returns>The final bounds according to some configuration like margin, minimum size, etc..</returns>
/// <param name="expectedBounds">The expected bounds.</param> /// <param name="expectedBounds">The expected bounds.</param>
virtual Rect GetBoundsInternal(Rect expectedBounds); virtual Rect GetBoundsInternal(Rect expectedBounds, bool considerPreferredMinSize);
void UpdatePreviousBounds(Rect bounds); void UpdatePreviousBounds(Rect bounds);
Size GetMinPreferredClientSizeInternal(bool considerPreferredMinSize)override;
Rect GetPreferredBoundsInternal(bool considerPreferredMinSize)override;
public: public:
GuiGraphicsSite(); GuiGraphicsSite();
~GuiGraphicsSite(); ~GuiGraphicsSite();
@@ -4246,8 +4183,6 @@ Basic Construction
compositions::GuiNotifyEvent BoundsChanged; compositions::GuiNotifyEvent BoundsChanged;
bool IsSizeAffectParent()override; bool IsSizeAffectParent()override;
Size GetMinPreferredClientSize()override;
Rect GetPreferredBounds()override;
/// <summary>Get the previous calculated bounds, ignoring any surrounding changes that could affect the bounds.</summary> /// <summary>Get the previous calculated bounds, ignoring any surrounding changes that could affect the bounds.</summary>
/// <returns>The previous calculated bounds.</returns> /// <returns>The previous calculated bounds.</returns>
@@ -4328,6 +4263,7 @@ Basic Compositions
Rect compositionBounds; Rect compositionBounds;
Margin alignmentToParent{ -1,-1,-1,-1 }; Margin alignmentToParent{ -1,-1,-1,-1 };
Rect GetPreferredBoundsInternal(bool considerPreferredMinSize)override;
public: public:
GuiBoundsComposition(); GuiBoundsComposition();
~GuiBoundsComposition(); ~GuiBoundsComposition();
@@ -4340,7 +4276,6 @@ Basic Compositions
void SetSizeAffectParent(bool value); void SetSizeAffectParent(bool value);
bool IsSizeAffectParent()override; bool IsSizeAffectParent()override;
Rect GetPreferredBounds()override;
Rect GetBounds()override; Rect GetBounds()override;
/// <summary>Set the expected bounds.</summary> /// <summary>Set the expected bounds.</summary>
/// <param name="value">The expected bounds.</param> /// <param name="value">The expected bounds.</param>
@@ -4789,6 +4724,7 @@ Host
HostRecord hostRecord; HostRecord hostRecord;
bool supressPaint = false; bool supressPaint = false;
bool needRender = true; bool needRender = true;
bool renderingTriggeredInLastFrame = false;
ProcList afterRenderProcs; ProcList afterRenderProcs;
ProcMap afterRenderKeyedProcs; ProcMap afterRenderKeyedProcs;
@@ -4849,9 +4785,11 @@ Host
void Char(const NativeWindowCharInfo& info)override; void Char(const NativeWindowCharInfo& info)override;
bool NeedRefresh()override; bool NeedRefresh()override;
void ForceRefresh(bool handleFailure, bool& failureByResized, bool& failureByLostDevice)override; void ForceRefresh(bool handleFailure, bool& updated, bool& failureByResized, bool& failureByLostDevice)override;
void GlobalTimer()override; void GlobalTimer()override;
elements::RenderTargetFailure Render(bool forceUpdate, bool handleFailure, bool& updated);
public: public:
GuiGraphicsHost(controls::GuiControlHost* _controlHost, GuiGraphicsComposition* boundsComposition); GuiGraphicsHost(controls::GuiControlHost* _controlHost, GuiGraphicsComposition* boundsComposition);
~GuiGraphicsHost(); ~GuiGraphicsHost();
@@ -4865,10 +4803,6 @@ Host
/// <summary>Get the main <see cref="GuiWindowComposition"/>. If a window is associated, everything that put into the main composition will be shown in the window.</summary> /// <summary>Get the main <see cref="GuiWindowComposition"/>. If a window is associated, everything that put into the main composition will be shown in the window.</summary>
/// <returns>The main compositoin.</returns> /// <returns>The main compositoin.</returns>
GuiGraphicsComposition* GetMainComposition(); GuiGraphicsComposition* GetMainComposition();
/// <summary>Render the main composition and all content to the associated window.</summary>
/// <param name="forceUpdate">Set to true to force updating layout and then render.</param>
/// <param name="forceUpdate">Set to true to force updating layout and then render.</param>
elements::RenderTargetFailure Render(bool forceUpdate, bool handleFailure);
/// <summary>Request a rendering</summary> /// <summary>Request a rendering</summary>
void RequestRender(); void RequestRender();
/// <summary>Invoke a specified function after rendering.</summary> /// <summary>Invoke a specified function after rendering.</summary>
@@ -5031,6 +4965,7 @@ Flow Compositions
void OnBoundsChanged(GuiGraphicsComposition* sender, GuiEventArgs& arguments); void OnBoundsChanged(GuiGraphicsComposition* sender, GuiEventArgs& arguments);
void OnChildInserted(GuiGraphicsComposition* child)override; void OnChildInserted(GuiGraphicsComposition* child)override;
void OnChildRemoved(GuiGraphicsComposition* child)override; void OnChildRemoved(GuiGraphicsComposition* child)override;
Size GetMinPreferredClientSizeInternal(bool considerPreferredMinSize)override;
public: public:
GuiFlowComposition(); GuiFlowComposition();
~GuiFlowComposition(); ~GuiFlowComposition();
@@ -5080,7 +5015,6 @@ Flow Compositions
void SetAlignment(FlowAlignment value); void SetAlignment(FlowAlignment value);
void ForceCalculateSizeImmediately()override; void ForceCalculateSizeImmediately()override;
Size GetMinPreferredClientSize()override;
Rect GetBounds()override; Rect GetBounds()override;
}; };
@@ -5106,6 +5040,8 @@ Flow Compositions
double percentage = 0.0; double percentage = 0.0;
/// <summary>The distance value.</summary> /// <summary>The distance value.</summary>
vint distance = 0; vint distance = 0;
bool operator==(const GuiFlowOption& value) const = default;
}; };
/// <summary> /// <summary>
@@ -5702,6 +5638,7 @@ Stack Compositions
void OnBoundsChanged(GuiGraphicsComposition* sender, GuiEventArgs& arguments); void OnBoundsChanged(GuiGraphicsComposition* sender, GuiEventArgs& arguments);
void OnChildInserted(GuiGraphicsComposition* child)override; void OnChildInserted(GuiGraphicsComposition* child)override;
void OnChildRemoved(GuiGraphicsComposition* child)override; void OnChildRemoved(GuiGraphicsComposition* child)override;
Size GetMinPreferredClientSizeInternal(bool considerPreferredMinSize)override;
public: public:
GuiStackComposition(); GuiStackComposition();
~GuiStackComposition(); ~GuiStackComposition();
@@ -5729,7 +5666,6 @@ Stack Compositions
void SetPadding(vint value); void SetPadding(vint value);
void ForceCalculateSizeImmediately()override; void ForceCalculateSizeImmediately()override;
Size GetMinPreferredClientSize()override;
Rect GetBounds()override; Rect GetBounds()override;
/// <summary>Get the extra margin inside the stack composition.</summary> /// <summary>Get the extra margin inside the stack composition.</summary>
@@ -5932,8 +5868,7 @@ Table Compositions
{ {
} }
bool operator==(const GuiCellOption& value){return false;} bool operator==(const GuiCellOption& value) const = default;
bool operator!=(const GuiCellOption& value){return true;}
/// <summary>Creates an absolute sizing option</summary> /// <summary>Creates an absolute sizing option</summary>
/// <returns>The created option.</returns> /// <returns>The created option.</returns>
@@ -6025,6 +5960,7 @@ Table Compositions
); );
void OnRenderContextChanged()override; void OnRenderContextChanged()override;
Size GetMinPreferredClientSizeInternal(bool considerPreferredMinSize)override;
public: public:
GuiTableComposition(); GuiTableComposition();
~GuiTableComposition(); ~GuiTableComposition();
@@ -6085,7 +6021,6 @@ Table Compositions
void UpdateCellBounds(); void UpdateCellBounds();
void ForceCalculateSizeImmediately()override; void ForceCalculateSizeImmediately()override;
Size GetMinPreferredClientSize()override;
Rect GetBounds()override; Rect GetBounds()override;
}; };
@@ -6490,14 +6425,12 @@ Helpers
TVALUE resource;\ TVALUE resource;\
vint counter;\ vint counter;\
bool operator==(const Package& package)const{return false;}\ bool operator==(const Package& package)const{return false;}\
bool operator!=(const Package& package)const{return true;}\
};\ };\
struct DeadPackage\ struct DeadPackage\
{\ {\
TKEY key;\ TKEY key;\
TVALUE value;\ TVALUE value;\
bool operator==(const DeadPackage& package)const{return false;}\ bool operator==(const DeadPackage& package)const{return false;}\
bool operator!=(const DeadPackage& package)const{return true;}\
};\ };\
Dictionary<TKEY, Package> aliveResources;\ Dictionary<TKEY, Package> aliveResources;\
List<DeadPackage> deadResources;\ List<DeadPackage> deadResources;\
@@ -7659,7 +7592,6 @@ Global String Key
vint key = -1; vint key = -1;
public: public:
inline vint Compare(GlobalStringKey value)const{ return key - value.key; }
GUI_DEFINE_COMPARE_OPERATORS(GlobalStringKey) GUI_DEFINE_COMPARE_OPERATORS(GlobalStringKey)
static GlobalStringKey Get(const WString& string); static GlobalStringKey Get(const WString& string);
@@ -7817,8 +7749,7 @@ Resource Structure
GuiResourceLocation(const WString& _resourcePath, const WString& _filePath); GuiResourceLocation(const WString& _resourcePath, const WString& _filePath);
GuiResourceLocation(Ptr<GuiResourceNodeBase> node); GuiResourceLocation(Ptr<GuiResourceNodeBase> node);
bool operator==(const GuiResourceLocation& b)const { return resourcePath == b.resourcePath && filePath == b.filePath; } GUI_DEFINE_COMPARE_OPERATORS(GuiResourceLocation)
bool operator!=(const GuiResourceLocation& b)const { return !(*this == b); }
}; };
struct GuiResourceTextPos struct GuiResourceTextPos
@@ -7830,8 +7761,7 @@ Resource Structure
GuiResourceTextPos() = default; GuiResourceTextPos() = default;
GuiResourceTextPos(GuiResourceLocation location, glr::ParsingTextPos position); GuiResourceTextPos(GuiResourceLocation location, glr::ParsingTextPos position);
bool operator==(const GuiResourceTextPos& b)const { return originalLocation == b.originalLocation && row == b.row && column == b.column; } GUI_DEFINE_COMPARE_OPERATORS(GuiResourceTextPos)
bool operator!=(const GuiResourceTextPos& b)const { return !(*this == b); }
}; };
struct GuiResourceError struct GuiResourceError
@@ -7848,8 +7778,7 @@ Resource Structure
GuiResourceError(GuiResourceLocation _location, const WString& _message); GuiResourceError(GuiResourceLocation _location, const WString& _message);
GuiResourceError(GuiResourceLocation _location, GuiResourceTextPos _position, const WString& _message); GuiResourceError(GuiResourceLocation _location, GuiResourceTextPos _position, const WString& _message);
bool operator==(const GuiResourceError& b)const { return location == b.location && position == b.position && message == b.message; } GUI_DEFINE_COMPARE_OPERATORS(GuiResourceError)
bool operator!=(const GuiResourceError& b)const { return !(*this == b); }
static void Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List<glr::ParsingError>& parsingErrors); static void Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List<glr::ParsingError>& parsingErrors);
static void Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List<glr::ParsingError>& parsingErrors, glr::ParsingTextPos offset); static void Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List<glr::ParsingError>& parsingErrors, glr::ParsingTextPos offset);
@@ -10533,15 +10462,7 @@ Rich Content Document (style)
static DocumentFontSize Parse(const WString& value); static DocumentFontSize Parse(const WString& value);
WString ToString()const; WString ToString()const;
bool operator==(const DocumentFontSize& value)const bool operator==(const DocumentFontSize& value) const = default;
{
return size == value.size && relative == value.relative;
}
bool operator!=(const DocumentFontSize& value)const
{
return size != value.size || relative != value.relative;
}
}; };
/// <summary>Represents a text style.</summary> /// <summary>Represents a text style.</summary>
@@ -10922,8 +10843,7 @@ Elements
int radiusX = 0; int radiusX = 0;
int radiusY = 0; int radiusY = 0;
bool operator==(const ElementShape& value)const { return shapeType == value.shapeType && radiusX == value.radiusX && radiusY == value.radiusY; } bool operator==(const ElementShape& value) const = default;
bool operator!=(const ElementShape& value)const { return !(*this == value); }
}; };
/// <summary> /// <summary>
@@ -11915,8 +11835,7 @@ Colorized Plain Text (model)
~TextLine(); ~TextLine();
static vint CalculateBufferLength(vint dataLength); static vint CalculateBufferLength(vint dataLength);
bool operator==(const TextLine& value)const{return false;} bool operator==(const TextLine& value) const { return false; }
bool operator!=(const TextLine& value)const{return true;}
/// <summary> /// <summary>
/// Initialize the <see cref="TextLine"/> instance to be an empty line. /// Initialize the <see cref="TextLine"/> instance to be an empty line.
@@ -12266,13 +12185,6 @@ Colorized Plain Text (model)
/// </summary> /// </summary>
Color background; Color background;
inline vint64_t Compare(const ColorItem& value)const
{
vint64_t result;
if ((result = text.Compare(value.text)) != 0) return result;
if ((result = background.Compare(value.background)) != 0) return result;
return 0;
}
GUI_DEFINE_COMPARE_OPERATORS(ColorItem) GUI_DEFINE_COMPARE_OPERATORS(ColorItem)
}; };
@@ -12294,14 +12206,6 @@ Colorized Plain Text (model)
/// </summary> /// </summary>
ColorItem selectedUnfocused; ColorItem selectedUnfocused;
inline vint64_t Compare(const ColorEntry& value)const
{
vint64_t result;
if ((result = normal.Compare(value.normal)) != 0) return result;
if ((result = selectedFocused.Compare(value.selectedFocused)) != 0) return result;
if ((result = selectedUnfocused.Compare(value.selectedUnfocused)) != 0) return result;
return 0;
}
GUI_DEFINE_COMPARE_OPERATORS(ColorEntry) GUI_DEFINE_COMPARE_OPERATORS(ColorEntry)
}; };
} }
@@ -14295,7 +14199,6 @@ TextItemProvider
~TextItem(); ~TextItem();
bool operator==(const TextItem& value)const; bool operator==(const TextItem& value)const;
bool operator!=(const TextItem& value)const;
/// <summary>Get the text of this item.</summary> /// <summary>Get the text of this item.</summary>
/// <returns>The text of this item.</returns> /// <returns>The text of this item.</returns>
@@ -20551,13 +20454,6 @@ Ribbon Gallery List
{ {
} }
inline vint Compare(const GalleryPos& value)const
{
vint result;
if ((result = group - value.group) != 0) return result;
if ((result = item - value.item) != 0) return result;
return 0;
}
GUI_DEFINE_COMPARE_OPERATORS(GalleryPos) GUI_DEFINE_COMPARE_OPERATORS(GalleryPos)
}; };
@@ -25058,6 +24954,7 @@ GuiHostedController
protected: protected:
SharedCallbackService callbackService; SharedCallbackService callbackService;
hosted_window_manager::WindowManager<GuiHostedWindow*>* wmManager = nullptr; hosted_window_manager::WindowManager<GuiHostedWindow*>* wmManager = nullptr;
bool windowsUpdatedInLastFrame = false;
INativeController* nativeController = nullptr; INativeController* nativeController = nullptr;
elements::GuiHostedGraphicsResourceManager* hostedResourceManager = nullptr; elements::GuiHostedGraphicsResourceManager* hostedResourceManager = nullptr;
collections::SortedList<Ptr<GuiHostedWindow>> createdWindows; collections::SortedList<Ptr<GuiHostedWindow>> createdWindows;
+22 -47
View File
@@ -2030,7 +2030,7 @@ GuiDefaultInstanceLoader
} }
else else
{ {
PropertyType value(GuiInstancePropertyInfo::Unsupported(), 0); PropertyType value(GuiInstancePropertyInfo::Unsupported(), nullptr);
propertyTypes.Add(key, value); propertyTypes.Add(key, value);
return value; return value;
} }
@@ -2043,7 +2043,7 @@ GuiDefaultInstanceLoader
Ptr<GuiInstancePropertyInfo> GetPropertyType(GuiResourcePrecompileContext& precompileContext, const PropertyInfo& propertyInfo)override Ptr<GuiInstancePropertyInfo> GetPropertyType(GuiResourcePrecompileContext& precompileContext, const PropertyInfo& propertyInfo)override
{ {
return GetPropertyTypeCached(propertyInfo).f0; return GetPropertyTypeCached(propertyInfo).get<0>();
} }
//*********************************************************************************** //***********************************************************************************
@@ -2141,9 +2141,9 @@ GuiDefaultInstanceLoader
for (auto [prop, index] : indexed(arguments.Keys())) for (auto [prop, index] : indexed(arguments.Keys()))
{ {
PropertyType propertyType = GetPropertyTypeCached(PropertyInfo(typeInfo, prop)); PropertyType propertyType = GetPropertyTypeCached(PropertyInfo(typeInfo, prop));
if (propertyType.f1) if (propertyType.get<1>())
{ {
switch (propertyType.f0->support) switch (propertyType.get<0>()->support)
{ {
case GuiInstancePropertyInfo::SupportCollection: case GuiInstancePropertyInfo::SupportCollection:
{ {
@@ -5301,7 +5301,7 @@ GuiInstanceLocalizedStrings
textDesc->texts.Add(reading); textDesc->texts.Add(reading);
} }
for (auto [i, index] : indexed(From(textDesc->positions).OrderBy([](vint a, vint b) {return a - b; }))) for (auto [i, index] : indexed(From(textDesc->positions).OrderBySelf()))
{ {
if (i != index) if (i != index)
{ {
@@ -9367,12 +9367,8 @@ Licensed under https://github.com/vczh-libraries/License
***********************************************************************/ ***********************************************************************/
namespace vl namespace vl::presentation::instancequery
{ {
namespace presentation
{
namespace instancequery
{
/*********************************************************************** /***********************************************************************
Visitor Pattern Implementation Visitor Pattern Implementation
***********************************************************************/ ***********************************************************************/
@@ -9391,15 +9387,9 @@ Visitor Pattern Implementation
{ {
visitor->Visit(this); visitor->Visit(this);
} }
}
}
} }
namespace vl namespace vl::reflection::description
{ {
namespace reflection
{
namespace description
{
#ifndef VCZH_DEBUG_NO_REFLECTION #ifndef VCZH_DEBUG_NO_REFLECTION
IMPL_TYPE_INFO_RENAME(vl::presentation::instancequery::GuiIqQuery, presentation::instancequery::GuiIqQuery) IMPL_TYPE_INFO_RENAME(vl::presentation::instancequery::GuiIqQuery, presentation::instancequery::GuiIqQuery)
@@ -9512,8 +9502,6 @@ namespace vl
#endif #endif
return false; return false;
} }
}
}
} }
@@ -9527,12 +9515,8 @@ Licensed under https://github.com/vczh-libraries/License
***********************************************************************/ ***********************************************************************/
namespace vl namespace vl::presentation::instancequery
{ {
namespace presentation
{
namespace instancequery
{
void GuiInstanceQueryParserData(vl::stream::IStream& outputStream) void GuiInstanceQueryParserData(vl::stream::IStream& outputStream)
{ {
static const vl::vint dataLength = 3046; // 28794 bytes before compressing static const vl::vint dataLength = 3046; // 28794 bytes before compressing
@@ -9631,23 +9615,26 @@ namespace vl
Parser::Parser() Parser::Parser()
: vl::glr::ParserBase<GuiInstanceQueryTokens, ParserStates, GuiInstanceQueryAstInsReceiver>(&GuiInstanceQueryTokenDeleter, &GuiInstanceQueryLexerData, &GuiInstanceQueryParserData) : vl::glr::ParserBase<GuiInstanceQueryTokens, ParserStates, GuiInstanceQueryAstInsReceiver>(&GuiInstanceQueryTokenDeleter, &GuiInstanceQueryLexerData, &GuiInstanceQueryParserData)
{ {
}; }
vl::WString Parser::GetClassName(vl::vint32_t classIndex) const
{
return vl::WString::Unmanaged(GuiInstanceQueryTypeName((GuiInstanceQueryClasses)classIndex));
}
vl::vint32_t Parser::FindCommonBaseClass(vl::vint32_t class1, vl::vint32_t class2) const vl::vint32_t Parser::FindCommonBaseClass(vl::vint32_t class1, vl::vint32_t class2) const
{ {
return -1; return -1;
}; }
vl::Ptr<vl::presentation::instancequery::GuiIqQuery> Parser::ParseQueryRoot(const vl::WString& input, vl::vint codeIndex) const vl::Ptr<vl::presentation::instancequery::GuiIqQuery> Parser::ParseQueryRoot(const vl::WString& input, vl::vint codeIndex) const
{ {
return ParseWithString<vl::presentation::instancequery::GuiIqQuery, ParserStates::QueryRoot>(input, this, codeIndex); return ParseWithString<vl::presentation::instancequery::GuiIqQuery, ParserStates::QueryRoot>(input, this, codeIndex);
}; }
vl::Ptr<vl::presentation::instancequery::GuiIqQuery> Parser::ParseQueryRoot(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const vl::Ptr<vl::presentation::instancequery::GuiIqQuery> Parser::ParseQueryRoot(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const
{ {
return ParseWithTokens<vl::presentation::instancequery::GuiIqQuery, ParserStates::QueryRoot>(tokens, this, codeIndex); return ParseWithTokens<vl::presentation::instancequery::GuiIqQuery, ParserStates::QueryRoot>(tokens, this, codeIndex);
};
}
} }
} }
@@ -9662,12 +9649,8 @@ Licensed under https://github.com/vczh-libraries/License
***********************************************************************/ ***********************************************************************/
namespace vl namespace vl::presentation::instancequery
{ {
namespace presentation
{
namespace instancequery
{
/*********************************************************************** /***********************************************************************
GuiInstanceQueryAstInsReceiver : public vl::glr::AstInsReceiverBase GuiInstanceQueryAstInsReceiver : public vl::glr::AstInsReceiverBase
@@ -9808,8 +9791,6 @@ GuiInstanceQueryAstInsReceiver : public vl::glr::AstInsReceiverBase
auto cppTypeName = GuiInstanceQueryCppTypeName((GuiInstanceQueryClasses)type); auto cppTypeName = GuiInstanceQueryCppTypeName((GuiInstanceQueryClasses)type);
return vl::glr::AssemblyThrowTypeNotAllowAmbiguity(type, cppTypeName); return vl::glr::AssemblyThrowTypeNotAllowAmbiguity(type, cppTypeName);
} }
}
}
} }
@@ -9823,12 +9804,8 @@ Licensed under https://github.com/vczh-libraries/License
***********************************************************************/ ***********************************************************************/
namespace vl namespace vl::presentation::instancequery
{ {
namespace presentation
{
namespace instancequery
{
bool GuiInstanceQueryTokenDeleter(vl::vint token) bool GuiInstanceQueryTokenDeleter(vl::vint token)
{ {
switch((GuiInstanceQueryTokens)token) switch((GuiInstanceQueryTokens)token)
@@ -9915,8 +9892,6 @@ namespace vl
}; };
vl::glr::DecompressSerializedData(compressed, true, dataSolidRows, dataRows, dataBlock, dataRemain, outputStream); vl::glr::DecompressSerializedData(compressed, true, dataSolidRows, dataRows, dataBlock, dataRemain, outputStream);
} }
}
}
} }
@@ -10517,7 +10492,7 @@ Workflow_GenerateInstanceClass
auto expression = Workflow_ParseExpression( auto expression = Workflow_ParseExpression(
precompileContext, precompileContext,
parameter->classPosition.originalLocation, parameter->classPosition.originalLocation,
L"cast("+parameterTypeInfoTuple.f1+L") (null of object)", L"cast("+parameterTypeInfoTuple.get<1>() + L") (null of object)",
parameter->classPosition, parameter->classPosition,
errors, errors,
{ 0,5 } { 0,5 }
@@ -10642,9 +10617,9 @@ Workflow_GenerateInstanceClass
{ {
auto parameterTypeInfoTuple = getDefaultType(parameter->className.ToString()); auto parameterTypeInfoTuple = getDefaultType(parameter->className.ToString());
vint errorCount = errors.Count(); vint errorCount = errors.Count();
auto type = Workflow_ParseType(precompileContext, { resolvingResult.resource }, parameterTypeInfoTuple.f1, parameter->classPosition, errors); auto type = Workflow_ParseType(precompileContext, { resolvingResult.resource }, parameterTypeInfoTuple.get<1>(), parameter->classPosition, errors);
if (!needFunctionBody && !parameterTypeInfoTuple.f0 && errorCount == errors.Count()) if (!needFunctionBody && !parameterTypeInfoTuple.get<0>() && errorCount == errors.Count())
{ {
if (!type || type.Cast<WfReferenceType>() || type.Cast<WfChildType>() || type.Cast<WfTopQualifiedType>()) if (!type || type.Cast<WfReferenceType>() || type.Cast<WfChildType>() || type.Cast<WfTopQualifiedType>())
{ {
@@ -10660,7 +10635,7 @@ Workflow_GenerateInstanceClass
decl->name.value = L"<parameter>" + parameter->name.ToString(); decl->name.value = L"<parameter>" + parameter->name.ToString();
decl->type = CopyType(type); decl->type = CopyType(type);
decl->expression = CreateDefaultValue(parameterTypeInfoTuple.f0.Obj()); decl->expression = CreateDefaultValue(parameterTypeInfoTuple.get<0>().Obj());
Workflow_RecordScriptPosition(precompileContext, parameter->tagPosition, (Ptr<WfDeclaration>)decl); Workflow_RecordScriptPosition(precompileContext, parameter->tagPosition, (Ptr<WfDeclaration>)decl);
} }
+6 -35
View File
@@ -264,12 +264,8 @@ Licensed under https://github.com/vczh-libraries/License
#define VCZH_PRESENTATION_INSTANCEQUERY_AST_AST #define VCZH_PRESENTATION_INSTANCEQUERY_AST_AST
namespace vl namespace vl::presentation::instancequery
{ {
namespace presentation
{
namespace instancequery
{
class GuiIqCascadeQuery; class GuiIqCascadeQuery;
class GuiIqPrimaryQuery; class GuiIqPrimaryQuery;
class GuiIqQuery; class GuiIqQuery;
@@ -344,15 +340,9 @@ namespace vl
void Accept(GuiIqQuery::IVisitor* visitor) override; void Accept(GuiIqQuery::IVisitor* visitor) override;
}; };
}
}
} }
namespace vl namespace vl::reflection::description
{ {
namespace reflection
{
namespace description
{
#ifndef VCZH_DEBUG_NO_REFLECTION #ifndef VCZH_DEBUG_NO_REFLECTION
DECL_TYPE_INFO(vl::presentation::instancequery::GuiIqQuery) DECL_TYPE_INFO(vl::presentation::instancequery::GuiIqQuery)
DECL_TYPE_INFO(vl::presentation::instancequery::GuiIqQuery::IVisitor) DECL_TYPE_INFO(vl::presentation::instancequery::GuiIqQuery::IVisitor)
@@ -388,8 +378,6 @@ namespace vl
/// <summary>Load all reflectable AST types, only available when <b>VCZH_DEBUG_NO_REFLECTION</b> is off.</summary> /// <summary>Load all reflectable AST types, only available when <b>VCZH_DEBUG_NO_REFLECTION</b> is off.</summary>
/// <returns>Returns true if this operation succeeded.</returns> /// <returns>Returns true if this operation succeeded.</returns>
extern bool GuiInstanceQueryAstLoadTypes(); extern bool GuiInstanceQueryAstLoadTypes();
}
}
} }
#endif #endif
@@ -874,12 +862,8 @@ Licensed under https://github.com/vczh-libraries/License
#define VCZH_PRESENTATION_INSTANCEQUERY_AST_ASSEMBLER #define VCZH_PRESENTATION_INSTANCEQUERY_AST_ASSEMBLER
namespace vl namespace vl::presentation::instancequery
{ {
namespace presentation
{
namespace instancequery
{
enum class GuiInstanceQueryClasses : vl::vint32_t enum class GuiInstanceQueryClasses : vl::vint32_t
{ {
CascadeQuery = 0, CascadeQuery = 0,
@@ -917,8 +901,6 @@ namespace vl
void SetField(vl::glr::ParsingAstBase* object, vl::vint32_t field, vl::vint32_t enumItem, bool weakAssignment) override; void SetField(vl::glr::ParsingAstBase* object, vl::vint32_t field, vl::vint32_t enumItem, bool weakAssignment) override;
vl::Ptr<vl::glr::ParsingAstBase> ResolveAmbiguity(vl::vint32_t type, vl::collections::Array<vl::Ptr<vl::glr::ParsingAstBase>>& candidates) override; vl::Ptr<vl::glr::ParsingAstBase> ResolveAmbiguity(vl::vint32_t type, vl::collections::Array<vl::Ptr<vl::glr::ParsingAstBase>>& candidates) override;
}; };
}
}
} }
#endif #endif
@@ -935,12 +917,8 @@ Licensed under https://github.com/vczh-libraries/License
#define VCZH_PRESENTATION_INSTANCEQUERY_LEXER #define VCZH_PRESENTATION_INSTANCEQUERY_LEXER
namespace vl namespace vl::presentation::instancequery
{ {
namespace presentation
{
namespace instancequery
{
enum class GuiInstanceQueryTokens : vl::vint32_t enum class GuiInstanceQueryTokens : vl::vint32_t
{ {
INDIRECT = 0, INDIRECT = 0,
@@ -964,8 +942,6 @@ namespace vl
extern const wchar_t* GuiInstanceQueryTokenDisplayText(GuiInstanceQueryTokens token); extern const wchar_t* GuiInstanceQueryTokenDisplayText(GuiInstanceQueryTokens token);
extern const wchar_t* GuiInstanceQueryTokenRegex(GuiInstanceQueryTokens token); extern const wchar_t* GuiInstanceQueryTokenRegex(GuiInstanceQueryTokens token);
extern void GuiInstanceQueryLexerData(vl::stream::IStream& outputStream); extern void GuiInstanceQueryLexerData(vl::stream::IStream& outputStream);
}
}
} }
#endif #endif
@@ -982,12 +958,8 @@ Licensed under https://github.com/vczh-libraries/License
#define VCZH_PRESENTATION_INSTANCEQUERY_PARSER_SYNTAX #define VCZH_PRESENTATION_INSTANCEQUERY_PARSER_SYNTAX
namespace vl namespace vl::presentation::instancequery
{ {
namespace presentation
{
namespace instancequery
{
enum class ParserStates enum class ParserStates
{ {
QPrimaryFragment = 0, QPrimaryFragment = 0,
@@ -1008,6 +980,7 @@ namespace vl
, protected vl::glr::automaton::IExecutor::ITypeCallback , protected vl::glr::automaton::IExecutor::ITypeCallback
{ {
protected: protected:
vl::WString GetClassName(vl::vint32_t classIndex) const override;
vl::vint32_t FindCommonBaseClass(vl::vint32_t class1, vl::vint32_t class2) const override; vl::vint32_t FindCommonBaseClass(vl::vint32_t class1, vl::vint32_t class2) const override;
public: public:
Parser(); Parser();
@@ -1015,8 +988,6 @@ namespace vl
vl::Ptr<vl::presentation::instancequery::GuiIqQuery> ParseQueryRoot(const vl::WString& input, vl::vint codeIndex = -1) const; vl::Ptr<vl::presentation::instancequery::GuiIqQuery> ParseQueryRoot(const vl::WString& input, vl::vint codeIndex = -1) const;
vl::Ptr<vl::presentation::instancequery::GuiIqQuery> ParseQueryRoot(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex = -1) const; vl::Ptr<vl::presentation::instancequery::GuiIqQuery> ParseQueryRoot(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex = -1) const;
}; };
}
}
} }
#endif #endif
+2
View File
@@ -3453,6 +3453,8 @@ Type Declaration
ENUM_CLASS_ITEM(RenderTargetChanged) ENUM_CLASS_ITEM(RenderTargetChanged)
ENUM_CLASS_ITEM(ParentLineChanged) ENUM_CLASS_ITEM(ParentLineChanged)
ENUM_CLASS_ITEM(ServiceAdded) ENUM_CLASS_ITEM(ServiceAdded)
ENUM_CLASS_ITEM(UpdateRequested)
ENUM_CLASS_ITEM(UpdateFullfilled)
END_ENUM_ITEM(ControlSignal) END_ENUM_ITEM(ControlSignal)
BEGIN_CLASS_MEMBER(GuiControlSignalEventArgs) BEGIN_CLASS_MEMBER(GuiControlSignalEventArgs)
+1430 -1781
View File
File diff suppressed because it is too large Load Diff
+468 -316
View File
File diff suppressed because it is too large Load Diff
+101 -226
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-3
View File
@@ -406,9 +406,6 @@ Utilities
, length(_length) , length(_length)
{ {
} }
bool operator==(const BufferPair& pair) { return false; }
bool operator!=(const BufferPair& pair) { return true; }
}; };
bool HttpQuery(const HttpRequest& request, HttpResponse& response) bool HttpQuery(const HttpRequest& request, HttpResponse& response)
-9
View File
@@ -62,11 +62,6 @@ FilePath
{ {
} }
vint FilePath::Compare(const FilePath& a, const FilePath& b)
{
return (vint)WString::Compare(a.fullPath, b.fullPath);
}
FilePath FilePath::operator/(const WString& relativePath)const FilePath FilePath::operator/(const WString& relativePath)const
{ {
if (IsRoot()) if (IsRoot())
@@ -449,10 +444,6 @@ Locale
{ {
} }
Locale::~Locale()
{
}
const WString& Locale::GetName()const const WString& Locale::GetName()const
{ {
return localeName; return localeName;
+13 -15
View File
@@ -175,15 +175,18 @@ namespace vl
/// In Windows, the specified locale need to be installed in order to take effect. /// In Windows, the specified locale need to be installed in order to take effect.
/// In Linux and macOS, only en-US is supported. /// In Linux and macOS, only en-US is supported.
/// </remarks> /// </remarks>
Locale(const WString& _localeName=WString::Empty); Locale() = default;
~Locale(); Locale(const Locale&) = default;
Locale(Locale&&) = default;
~Locale() = default;
bool operator==(const Locale& value)const { return localeName==value.localeName; } Locale& operator=(const Locale&) = default;
bool operator!=(const Locale& value)const { return localeName!=value.localeName; } Locale& operator=(Locale&&) = default;
bool operator<(const Locale& value)const { return localeName<value.localeName; }
bool operator<=(const Locale& value)const { return localeName<=value.localeName; } Locale(const WString& _localeName);
bool operator>(const Locale& value)const { return localeName>value.localeName; }
bool operator>=(const Locale& value)const { return localeName>=value.localeName; } std::strong_ordering operator<=>(const Locale& locale)const { return localeName <=> locale.localeName; }
bool operator==(const Locale& locale)const { return localeName == locale.localeName; }
/// <summary>Get the invariant locale. An invariant locale is neutral, it is not awared of any language specified thing.</summary> /// <summary>Get the invariant locale. An invariant locale is neutral, it is not awared of any language specified thing.</summary>
/// <returns>The invariant locale.</returns> /// <returns>The invariant locale.</returns>
@@ -1918,13 +1921,8 @@ namespace vl
FilePath(const FilePath& _filePath); FilePath(const FilePath& _filePath);
~FilePath() = default; ~FilePath() = default;
static vint Compare(const FilePath& a, const FilePath& b); std::strong_ordering operator<=>(const FilePath& path)const { return fullPath <=> path.fullPath; }
bool operator==(const FilePath& filePath)const{ return Compare(*this, filePath) == 0; } bool operator==(const FilePath& path)const { return fullPath == path.fullPath; }
bool operator!=(const FilePath& filePath)const{ return Compare(*this, filePath) != 0; }
bool operator< (const FilePath& filePath)const{ return Compare(*this, filePath) < 0; }
bool operator<=(const FilePath& filePath)const{ return Compare(*this, filePath) <= 0; }
bool operator> (const FilePath& filePath)const{ return Compare(*this, filePath) > 0; }
bool operator>=(const FilePath& filePath)const{ return Compare(*this, filePath) >= 0; }
/// <summary>Concat an absolute path and a relative path.</summary> /// <summary>Concat an absolute path and a relative path.</summary>
/// <returns>The result absolute path.</returns> /// <returns>The result absolute path.</returns>
+36 -34
View File
@@ -3740,7 +3740,7 @@ GenerateTable
i1 > i2 ? ParsingTable::TransitionItem::WrongOrder : i1 > i2 ? ParsingTable::TransitionItem::WrongOrder :
ParsingTable::TransitionItem::SameOrder ParsingTable::TransitionItem::SameOrder
; ;
return ParsingTable::TransitionItem::Compare(t1, t2, defaultOrder); return ParsingTable::TransitionItem::Compare(t1, t2, defaultOrder) <=> 0;
})); }));
// build look ahead inside a transition // build look ahead inside a transition
@@ -4225,38 +4225,44 @@ IsMergableCandidate
RearrangeState RearrangeState
***********************************************************************/ ***********************************************************************/
#define COMPARE_SYMBOL(S1, S2)\ std::strong_ordering CompareParsingSymbol(ParsingSymbol* s1, ParsingSymbol* s2)
if (S1 && S2)\
{\
if (S1->GetType() < S2->GetType()) return -1;\
if (S1->GetType() > S2->GetType()) return 1;\
if (S1->GetName() < S2->GetName()) return -1;\
if (S1->GetName() > S2->GetName()) return 1;\
}\
else if (S1)\
{\
return 1;\
}\
else if (S2)\
{\
return -1;\
}\
vint CompareTransitionForRearranging(Transition* t1, Transition* t2)
{ {
if (t1->transitionType < t2->transitionType) return -1; if (s1 && s2)
if (t1->transitionType > t2->transitionType) return 1; {
COMPARE_SYMBOL(t1->transitionSymbol, t2->transitionSymbol); std::strong_ordering
return 0; result = s1->GetType() <=> s2->GetType(); if (result != 0) return result;
result = s1->GetName() <=> s2->GetName(); if (result != 0) return result;
return result;
}
else if (s1)
{
return std::strong_ordering::greater;
}
else if (s2)
{
return std::strong_ordering::less;
}
else
{
return std::strong_ordering::equal;
}
} }
vint CompareActionForRearranging(Ptr<Action> a1, Ptr<Action> a2) std::strong_ordering CompareTransitionForRearranging(Transition* t1, Transition* t2)
{ {
if(a1->actionType<a2->actionType) return -1; std::strong_ordering
if(a1->actionType>a2->actionType) return 1; result = t1->transitionType <=> t2->transitionType; if (result != 0) return result;
COMPARE_SYMBOL(a1->actionSource, a2->actionSource); result = CompareParsingSymbol(t1->transitionSymbol, t2->transitionSymbol); if (result != 0) return result;
COMPARE_SYMBOL(a1->actionTarget, a2->actionTarget); return result;
return 0; }
std::strong_ordering CompareActionForRearranging(Ptr<Action> a1, Ptr<Action> a2)
{
std::strong_ordering
result = a1->actionType <=> a2->actionType; if (result != 0) return result;
result = CompareParsingSymbol(a1->actionSource, a2->actionSource); if (result != 0) return result;
result = CompareParsingSymbol(a1->actionTarget, a2->actionTarget); if (result != 0) return result;
return result;
} }
#undef COMPARE_SYMBOL #undef COMPARE_SYMBOL
@@ -8540,10 +8546,6 @@ namespace vl
namespace parsing namespace parsing
{ {
vint CompareTextRange(Ptr<ParsingTreeNode> r1, Ptr<ParsingTreeNode> r2)
{
return ParsingTextPos::Compare(r1->GetCodeRange().start, r2->GetCodeRange().start);
}
/*********************************************************************** /***********************************************************************
ParsingTreeNode::TraversalVisitor ParsingTreeNode::TraversalVisitor
@@ -8719,7 +8721,7 @@ ParsingTreeNode
const auto& range = node->GetCodeRange(); const auto& range = node->GetCodeRange();
return !range.start.IsInvalid() && !range.end.IsInvalid(); return !range.start.IsInvalid() && !range.end.IsInvalid();
}) })
.OrderBy(&CompareTextRange) .OrderByKey([](auto&& node) { return node->GetCodeRange().start; })
); );
} }
} }
+21 -26
View File
@@ -74,47 +74,45 @@ Location
return index < 0 && row < 0 && column < 0; return index < 0 && row < 0 && column < 0;
} }
static vint Compare(const ParsingTextPos& a, const ParsingTextPos& b) friend std::strong_ordering operator<=>(const ParsingTextPos& a, const ParsingTextPos& b)
{ {
if (a.IsInvalid() && b.IsInvalid()) if (a.IsInvalid() && b.IsInvalid())
{ {
return 0; return std::strong_ordering::equal;
} }
else if (a.IsInvalid()) else if (a.IsInvalid())
{ {
return -1; return std::strong_ordering::less;
} }
else if (b.IsInvalid()) else if (b.IsInvalid())
{ {
return 1; return std::strong_ordering::greater;
} }
else if (a.index >= 0 && b.index >= 0) else if (a.index >= 0 && b.index >= 0)
{ {
return a.index - b.index; return a.index <=> b.index;
} }
else if (a.row >= 0 && a.column >= 0 && b.row >= 0 && b.column >= 0) else if (a.row >= 0 && a.column >= 0 && b.row >= 0 && b.column >= 0)
{ {
if (a.row == b.row) if (a.row == b.row)
{ {
return a.column - b.column; return a.column <=> b.column;
} }
else else
{ {
return a.row - b.row; return a.row <=> b.row;
} }
} }
else else
{ {
return 0; return std::strong_ordering::equal;
} }
} }
bool operator==(const ParsingTextPos& pos)const{return Compare(*this, pos)==0;} friend bool operator==(const ParsingTextPos& a, const ParsingTextPos& b)
bool operator!=(const ParsingTextPos& pos)const{return Compare(*this, pos)!=0;} {
bool operator<(const ParsingTextPos& pos)const{return Compare(*this, pos)<0;} return (a <=> b) == 0;
bool operator<=(const ParsingTextPos& pos)const{return Compare(*this, pos)<=0;} }
bool operator>(const ParsingTextPos& pos)const{return Compare(*this, pos)>0;}
bool operator>=(const ParsingTextPos& pos)const{return Compare(*this, pos)>=0;}
}; };
/// <summary>A type representing text range.</summary> /// <summary>A type representing text range.</summary>
@@ -1124,21 +1122,18 @@ DefinitionTypeScopePair
{ {
} }
vint Compare(const DefinitionTypeScopePair& pair)const std::strong_ordering operator<=>(const DefinitionTypeScopePair& pair)const
{ {
if(type<pair.type) return -1; std::strong_ordering
if(type>pair.type) return 1; result = type <=> pair.type; if (result != 0) return result;
if(scope<pair.scope) return -1; result = scope <=> pair.scope; if (result != 0) return result;
if(scope>pair.scope) return 1; return result;
return 0;
} }
bool operator== (const DefinitionTypeScopePair& pair)const {return Compare(pair)==0;} bool operator==(const DefinitionTypeScopePair& pair)const
bool operator!= (const DefinitionTypeScopePair& pair)const {return Compare(pair)!=0;} {
bool operator> (const DefinitionTypeScopePair& pair)const {return Compare(pair)>0;} return (*this <=> pair) == 0;
bool operator>= (const DefinitionTypeScopePair& pair)const {return Compare(pair)>=0;} }
bool operator< (const DefinitionTypeScopePair& pair)const {return Compare(pair)<0;}
bool operator<= (const DefinitionTypeScopePair& pair)const {return Compare(pair)<=0;}
}; };
/*********************************************************************** /***********************************************************************
+120 -134
View File
@@ -2350,140 +2350,6 @@ description::Value
{ {
} }
vint Value::Compare(const Value& a, const Value& b)const
{
switch (a.GetValueType())
{
case Value::RawPtr:
case Value::SharedPtr:
switch (b.GetValueType())
{
case Value::RawPtr:
case Value::SharedPtr:
{
auto pa = a.GetRawPtr();
auto pb = b.GetRawPtr();
if (pa < pb) return -1;
if (pa > pb) return 1;
return 0;
}
case Value::BoxedValue:
return -1;
default:
return 1;
}
case Value::BoxedValue:
switch (b.GetValueType())
{
case Value::RawPtr:
case Value::SharedPtr:
return 1;
case Value::BoxedValue:
{
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
auto aSt = a.GetTypeDescriptor()->GetSerializableType();
auto bSt = b.GetTypeDescriptor()->GetSerializableType();
if (aSt)
{
if (bSt)
{
auto aSt = a.GetTypeDescriptor()->GetSerializableType();
auto bSt = b.GetTypeDescriptor()->GetSerializableType();
WString aText;
WString bText;
aSt->Serialize(a, aText);
bSt->Serialize(b, bText);
if (aText < bText) return -1;
if (aText > bText) return 1;
return 0;
}
else
{
return 1;
}
}
else
{
if (bSt)
{
return -1;
}
else
{
if (a.GetTypeDescriptor() != b.GetTypeDescriptor())
{
auto aText = a.GetTypeDescriptor()->GetTypeName();
auto bText = b.GetTypeDescriptor()->GetTypeName();
if (aText < bText) return -1;
if (aText > bText) return 1;
return 0;
}
switch (a.GetTypeDescriptor()->GetTypeDescriptorFlags())
{
case TypeDescriptorFlags::Struct:
{
auto td = a.GetTypeDescriptor();
vint count = td->GetPropertyCount();
for (vint i = 0; i < count; i++)
{
auto prop = td->GetProperty(i);
auto ap = prop->GetValue(a);
auto bp = prop->GetValue(b);
vint result = Compare(ap, bp);
if (result != 0)
{
return result;
}
}
}
return 0;
case TypeDescriptorFlags::FlagEnum:
case TypeDescriptorFlags::NormalEnum:
{
auto ai = a.GetTypeDescriptor()->GetEnumType()->FromEnum(a);
auto bi = a.GetTypeDescriptor()->GetEnumType()->FromEnum(b);
if (ai < bi) return -1;
if (ai > bi) return 1;
return 0;
}
default:
return 0;
}
}
}
#else
auto pa = a.GetBoxedValue();
auto pb = b.GetBoxedValue();
switch (pa->ComparePrimitive(pb))
{
case IBoxedValue::Smaller: return -1;
case IBoxedValue::Greater: return 1;
case IBoxedValue::Equal: return 0;
default:;
}
if (pa.Obj() < pb.Obj()) return -1;
if (pa.Obj() > pb.Obj()) return 1;
return 0;
#endif
}
default:
return 1;
}
default:
switch (b.GetValueType())
{
case Value::RawPtr:
case Value::SharedPtr:
case Value::BoxedValue:
return -1;
default:
return 0;
}
}
}
Value::Value() Value::Value()
:valueType(Null) :valueType(Null)
,rawPtr(0) ,rawPtr(0)
@@ -2516,6 +2382,126 @@ description::Value
return *this; return *this;
} }
std::strong_ordering operator<=>(const Value& a, const Value& b)
{
switch (a.GetValueType())
{
case Value::RawPtr:
case Value::SharedPtr:
switch (b.GetValueType())
{
case Value::RawPtr:
case Value::SharedPtr:
{
auto pa = a.GetRawPtr();
auto pb = b.GetRawPtr();
return pa <=> pb;
}
case Value::BoxedValue:
return std::strong_ordering::less;
default:
return std::strong_ordering::greater;
}
case Value::BoxedValue:
switch (b.GetValueType())
{
case Value::RawPtr:
case Value::SharedPtr:
return std::strong_ordering::greater;
case Value::BoxedValue:
{
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
auto aSt = a.GetTypeDescriptor()->GetSerializableType();
auto bSt = b.GetTypeDescriptor()->GetSerializableType();
if (aSt)
{
if (bSt)
{
auto aSt = a.GetTypeDescriptor()->GetSerializableType();
auto bSt = b.GetTypeDescriptor()->GetSerializableType();
WString aText;
WString bText;
aSt->Serialize(a, aText);
bSt->Serialize(b, bText);
return aText <=> bText;
}
else
{
return std::strong_ordering::greater;
}
}
else
{
if (bSt)
{
return std::strong_ordering::less;
}
else
{
if (a.GetTypeDescriptor() != b.GetTypeDescriptor())
{
auto aText = a.GetTypeDescriptor()->GetTypeName();
auto bText = b.GetTypeDescriptor()->GetTypeName();
return aText <=> bText;
}
switch (a.GetTypeDescriptor()->GetTypeDescriptorFlags())
{
case TypeDescriptorFlags::Struct:
{
auto td = a.GetTypeDescriptor();
vint count = td->GetPropertyCount();
for (vint i = 0; i < count; i++)
{
auto prop = td->GetProperty(i);
auto ap = prop->GetValue(a);
auto bp = prop->GetValue(b);
return ap <=> bp;
}
}
return std::strong_ordering::equal;
case TypeDescriptorFlags::FlagEnum:
case TypeDescriptorFlags::NormalEnum:
{
auto ai = a.GetTypeDescriptor()->GetEnumType()->FromEnum(a);
auto bi = a.GetTypeDescriptor()->GetEnumType()->FromEnum(b);
return ai <=> bi;
}
default:
return std::strong_ordering::equal;
}
}
}
#else
auto pa = a.GetBoxedValue();
auto pb = b.GetBoxedValue();
switch (pa->ComparePrimitive(pb))
{
case IBoxedValue::Smaller: return std::strong_ordering::less;
case IBoxedValue::Greater: return std::strong_ordering::greater;
case IBoxedValue::Equal: return std::strong_ordering::equal;
default:;
}
return pa.Obj() <=> pb.Obj();
#endif
}
default:
return std::strong_ordering::greater;
}
default:
switch (b.GetValueType())
{
case Value::RawPtr:
case Value::SharedPtr:
case Value::BoxedValue:
return std::strong_ordering::less;
default:
return std::strong_ordering::equal;
}
}
}
Value::ValueType Value::GetValueType()const Value::ValueType Value::GetValueType()const
{ {
return valueType; return valueType;
+3 -8
View File
@@ -827,19 +827,14 @@ Value
Value(DescriptableObject* value); Value(DescriptableObject* value);
Value(Ptr<DescriptableObject> value); Value(Ptr<DescriptableObject> value);
Value(Ptr<IBoxedValue> value, ITypeDescriptor* associatedTypeDescriptor); Value(Ptr<IBoxedValue> value, ITypeDescriptor* associatedTypeDescriptor);
vint Compare(const Value& a, const Value& b)const;
public: public:
/// <summary>Create a null value.</summary> /// <summary>Create a null value.</summary>
Value(); Value();
Value(const Value& value); Value(const Value& value);
Value& operator=(const Value& value); Value& operator=(const Value& value);
bool operator==(const Value& value)const { return Compare(*this, value) == 0; }
bool operator!=(const Value& value)const { return Compare(*this, value) != 0; } friend std::strong_ordering operator<=>(const Value& a, const Value& b);
bool operator<(const Value& value)const { return Compare(*this, value)<0; } friend bool operator==(const Value& a, const Value& b) { return (a <=> b) == 0; }
bool operator<=(const Value& value)const { return Compare(*this, value) <= 0; }
bool operator>(const Value& value)const { return Compare(*this, value)>0; }
bool operator>=(const Value& value)const { return Compare(*this, value) >= 0; }
/// <summary>Find out how the value is stored.</summary> /// <summary>Find out how the value is stored.</summary>
/// <returns>Returns How the value is stored.</returns> /// <returns>Returns How the value is stored.</returns>
-18
View File
@@ -1622,11 +1622,6 @@ Data Structures for Backtracking
StateSaver(const StateSaver&) = default; StateSaver(const StateSaver&) = default;
StateSaver& operator=(const StateSaver&) = default; StateSaver& operator=(const StateSaver&) = default;
bool operator==(const StateSaver& saver)const
{
CHECK_FAIL(L"This function is only created to satisfy List<T>.");
}
void RestoreReaderTo(StateSaver<TChar>& saver) void RestoreReaderTo(StateSaver<TChar>& saver)
{ {
saver.reader = reader; saver.reader = reader;
@@ -1653,11 +1648,6 @@ Data Structures for Backtracking
ExtensionSaver(const ExtensionSaver&) = default; ExtensionSaver(const ExtensionSaver&) = default;
ExtensionSaver& operator=(const ExtensionSaver&) = default; ExtensionSaver& operator=(const ExtensionSaver&) = default;
bool operator==(const ExtensionSaver& saver)const
{
CHECK_FAIL(L"This function is only created to satisfy List<T>.");
}
void RestoreReaderTo(StateSaver<TChar>& saver) void RestoreReaderTo(StateSaver<TChar>& saver)
{ {
saver.reader = reader; saver.reader = reader;
@@ -1717,14 +1707,6 @@ Data Structures for Backtracking
namespace regex_internal namespace regex_internal
{ {
/***********************************************************************
CaptureRecord
***********************************************************************/
bool CaptureRecord::operator==(const CaptureRecord& record)const
{
return capture == record.capture && start == record.start && length == record.length;
}
/*********************************************************************** /***********************************************************************
RichInterpretor RichInterpretor
+11 -49
View File
@@ -1375,65 +1375,29 @@ CharRange
CharRange() = default; CharRange() = default;
CharRange(char32_t _begin, char32_t _end) : begin(_begin), end(_end) {} CharRange(char32_t _begin, char32_t _end) : begin(_begin), end(_end) {}
bool operator<(CharRange item) const std::partial_ordering operator<=>(const CharRange& cr)const
{ {
return end < item.begin; if (end < cr.begin) return std::partial_ordering::less;
if (cr.end < begin) return std::partial_ordering::greater;
return *this == cr ? std::partial_ordering::equivalent : std::partial_ordering::unordered;
} }
bool operator<=(CharRange item) const bool operator==(const CharRange& cr)const
{ {
return *this < item || *this == item; return begin == cr.begin && end == cr.end;
} }
bool operator>(CharRange item) const std::strong_ordering operator<=>(char32_t item)const
{ {
return item.end < begin; if (end < item) return std::strong_ordering::less;
if (begin > item) return std::strong_ordering::greater;
return std::strong_ordering::equal;
} }
bool operator>=(CharRange item) const bool operator==(char32_t item)const
{
return *this > item || *this == item;
}
bool operator==(CharRange item) const
{
return begin == item.begin && end == item.end;
}
bool operator!=(CharRange item) const
{
return begin != item.begin || item.end != end;
}
bool operator<(char32_t item) const
{
return end < item;
}
bool operator<=(char32_t item) const
{
return begin <= item;
}
bool operator>(char32_t item) const
{
return item < begin;
}
bool operator>=(char32_t item) const
{
return item <= end;
}
bool operator==(char32_t item) const
{ {
return begin <= item && item <= end; return begin <= item && item <= end;
} }
bool operator!=(char32_t item) const
{
return item < begin || end < item;
}
}; };
} }
} }
@@ -2092,8 +2056,6 @@ namespace vl
vint capture; vint capture;
vint start; vint start;
vint length; vint length;
bool operator==(const CaptureRecord& record)const;
}; };
} }
+60 -105
View File
@@ -2587,18 +2587,16 @@ CheckScopes_SymbolType
{ {
vint errorCount = manager->errors.Count(); vint errorCount = manager->errors.Count();
for (auto scope : From(manager->nodeScopes) for (auto scope : From(manager->nodeScopes)
.Select([](auto&& pair) -> Pair<glr::ParsingAstBase*, Ptr<WfLexicalScope>> { return pair; })
.OrderBy([](auto&& a, auto&& b) .OrderBy([](auto&& a, auto&& b)
{ {
auto rangeA = a.key->codeRange; auto rangeA = a.key->codeRange;
auto rangeB = b.key->codeRange; auto rangeB = b.key->codeRange;
if (rangeA.codeIndex != rangeB.codeIndex)
{ std::strong_ordering
return rangeA.codeIndex - rangeB.codeIndex; result = rangeA.codeIndex <=> rangeB.codeIndex; if (result != 0) return result;
} result = rangeA.start <=> rangeB.start; if (result != 0) return result;
else return result;
{
return glr::ParsingTextPos::Compare(rangeA.start, rangeB.start);
}
}) })
.Select([](auto&& pair) { return pair.value; }) .Select([](auto&& pair) { return pair.value; })
) )
@@ -3641,7 +3639,7 @@ namespace vl
WString description; WString description;
for (auto friendlyName : From(items) for (auto friendlyName : From(items)
.Select(f) .Select(f)
.OrderBy([](auto&& a, auto&& b) { return WString::Compare(a, b); }) .OrderBySelf()
) )
{ {
description += L"\r\n\t"; description += L"\r\n\t";
@@ -7454,9 +7452,9 @@ ExpandNewCoroutineExpression
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
for (auto symbol : From(referenceRenaming.Keys()) for (auto symbol : From(referenceRenaming.Keys())
.OrderBy([&](WfLexicalSymbol* a, WfLexicalSymbol* b) .OrderByKey([&](WfLexicalSymbol* a)
{ {
return WString::Compare(referenceRenaming[a], referenceRenaming[b]); return referenceRenaming[a];
})) }))
{ {
auto varDecl = Ptr(new WfVariableDeclaration); auto varDecl = Ptr(new WfVariableDeclaration);
@@ -7688,9 +7686,9 @@ ExpandNewCoroutineExpression
{ {
return node->exceptionDestination; return node->exceptionDestination;
}) })
.OrderBy([&](const GroupPair& p1, const GroupPair& p2) .OrderByKey([&](const GroupPair& p)
{ {
return nodeOrders.IndexOf(p1.key) - nodeOrders.IndexOf(p2.key); return nodeOrders.IndexOf(p.key);
}); });
for (auto group : nodeByCatches) for (auto group : nodeByCatches)
@@ -7708,9 +7706,9 @@ ExpandNewCoroutineExpression
{ {
conditionRanges.Add({ state,state }); conditionRanges.Add({ state,state });
} }
else if (conditionRanges[conditionRanges.Count() - 1].f1 == state - 1) else if (conditionRanges[conditionRanges.Count() - 1].get<1>() == state - 1)
{ {
conditionRanges[conditionRanges.Count() - 1].f1 = state; conditionRanges[conditionRanges.Count() - 1].get<1>() = state;
} }
else else
{ {
@@ -7723,13 +7721,13 @@ ExpandNewCoroutineExpression
auto range = conditionRanges[i]; auto range = conditionRanges[i];
Ptr<WfExpression> singleCondition; Ptr<WfExpression> singleCondition;
if (range.f0 == range.f1) if (range.get<0>() == range.get<1>())
{ {
auto refState = Ptr(new WfReferenceExpression); auto refState = Ptr(new WfReferenceExpression);
refState->name.value = L"<co-state-before-pause>"; refState->name.value = L"<co-state-before-pause>";
auto intState = Ptr(new WfIntegerExpression); auto intState = Ptr(new WfIntegerExpression);
intState->value.value = itow(range.f0); intState->value.value = itow(range.get<0>());
auto compExpr = Ptr(new WfBinaryExpression); auto compExpr = Ptr(new WfBinaryExpression);
compExpr->op = WfBinaryOperator::EQ; compExpr->op = WfBinaryOperator::EQ;
@@ -7744,10 +7742,10 @@ ExpandNewCoroutineExpression
refState->name.value = L"<co-state-before-pause>"; refState->name.value = L"<co-state-before-pause>";
auto intState1 = Ptr(new WfIntegerExpression); auto intState1 = Ptr(new WfIntegerExpression);
intState1->value.value = itow(range.f0); intState1->value.value = itow(range.get<0>());
auto intState2 = Ptr(new WfIntegerExpression); auto intState2 = Ptr(new WfIntegerExpression);
intState2->value.value = itow(range.f1); intState2->value.value = itow(range.get<1>());
auto rangeExpr = Ptr(new WfRangeExpression); auto rangeExpr = Ptr(new WfRangeExpression);
rangeExpr->begin = intState1; rangeExpr->begin = intState1;
@@ -7855,9 +7853,9 @@ ExpandNewCoroutineExpression
{ {
return node->exceptionDestination; return node->exceptionDestination;
}) })
.OrderBy([&](const GroupPair& p1, const GroupPair& p2) .OrderByKey([&](const GroupPair& p)
{ {
return nodeOrders.IndexOf(p1.key) - nodeOrders.IndexOf(p2.key); return nodeOrders.IndexOf(p.key);
}); });
for (auto group : nodeByCatches) for (auto group : nodeByCatches)
@@ -12328,7 +12326,7 @@ ValidateSemantic(Expression)
{ {
vint aId = wtoi(a->name.Sub(1, a->name.Length() - 1)); vint aId = wtoi(a->name.Sub(1, a->name.Length() - 1));
vint bId = wtoi(b->name.Sub(1, a->name.Length() - 1)); vint bId = wtoi(b->name.Sub(1, a->name.Length() - 1));
return aId - bId; return aId <=> bId;
}) })
); );
Ptr<ITypeInfo> resultType = expectedType; Ptr<ITypeInfo> resultType = expectedType;
@@ -17297,7 +17295,7 @@ WfCppConfig::Collect
SortLambda<ITypeDescriptor*>(&tds[0], tds.Count(), [](ITypeDescriptor* a, ITypeDescriptor* b) SortLambda<ITypeDescriptor*>(&tds[0], tds.Count(), [](ITypeDescriptor* a, ITypeDescriptor* b)
{ {
return WString::Compare(a->GetTypeName(), b->GetTypeName()); return a->GetTypeName() <=> b->GetTypeName();
}); });
manager->errors.Add(WfErrors::CppUnableToDecideClassOrder(tdDecls[tds[0]].Cast<WfClassDeclaration>().Obj(), tds)); manager->errors.Add(WfErrors::CppUnableToDecideClassOrder(tdDecls[tds[0]].Cast<WfClassDeclaration>().Obj(), tds));
} }
@@ -17389,7 +17387,7 @@ WfCppConfig::Collect
SortLambda<ITypeDescriptor*>(&tds[0], tds.Count(), [](ITypeDescriptor* a, ITypeDescriptor* b) SortLambda<ITypeDescriptor*>(&tds[0], tds.Count(), [](ITypeDescriptor* a, ITypeDescriptor* b)
{ {
return WString::Compare(a->GetTypeName(), b->GetTypeName()); return a->GetTypeName() <=> b->GetTypeName();
}); });
manager->errors.Add(WfErrors::CppUnableToSeparateCustomFile(tdDecls[tds[0]].Cast<WfClassDeclaration>().Obj(), tds)); manager->errors.Add(WfErrors::CppUnableToSeparateCustomFile(tdDecls[tds[0]].Cast<WfClassDeclaration>().Obj(), tds));
} }
@@ -17435,7 +17433,7 @@ WfCppConfig::Collect
vint indexB = From(nodeB.firstSubClassItem, nodeB.firstSubClassItem + nodeB.subClassItemCount) vint indexB = From(nodeB.firstSubClassItem, nodeB.firstSubClassItem + nodeB.subClassItemCount)
.Select([&](vint index) {return globalDep.topLevelClasses[index]; }) .Select([&](vint index) {return globalDep.topLevelClasses[index]; })
.Min(); .Min();
return indexA - indexB; return indexA <=> indexB;
}); });
} }
}; };
@@ -17648,7 +17646,7 @@ WfCppConfig::Collect
{ {
vint aIndex = ordered.IndexOf(a.Obj()); vint aIndex = ordered.IndexOf(a.Obj());
vint bIndex = ordered.IndexOf(b.Obj()); vint bIndex = ordered.IndexOf(b.Obj());
return aIndex - bIndex; return aIndex <=> bIndex;
}); });
} }
@@ -17659,7 +17657,7 @@ WfCppConfig::Collect
{ {
vint aIndex = ordered.IndexOf(a.Obj()); vint aIndex = ordered.IndexOf(a.Obj());
vint bIndex = ordered.IndexOf(b.Obj()); vint bIndex = ordered.IndexOf(b.Obj());
return aIndex - bIndex; return aIndex <=> bIndex;
}); });
} }
} }
@@ -22144,7 +22142,7 @@ namespace vl
{ {
return scope->symbols.GetByIndex(index)[0]->name; return scope->symbols.GetByIndex(index)[0]->name;
}) })
.OrderBy((vint64_t(*)(const WString&, const WString&))&WString::Compare) .OrderBySelf()
); );
return WriteFunctionHeader(writer, typeInfo, arguments, name, writeReturnType); return WriteFunctionHeader(writer, typeInfo, arguments, name, writeReturnType);
@@ -22809,9 +22807,9 @@ namespace vl
CopyFrom( CopyFrom(
tds, tds,
From(config->manager->declarationTypes.Values()) From(config->manager->declarationTypes.Values())
.OrderBy([](Ptr<ITypeDescriptor> a, Ptr<ITypeDescriptor> b) .OrderByKey([](auto&& a)
{ {
return WString::Compare(a->GetTypeName(), b->GetTypeName()); return a->GetTypeName();
}) })
.Select([](Ptr<ITypeDescriptor> td) .Select([](Ptr<ITypeDescriptor> td)
{ {
@@ -23369,7 +23367,7 @@ namespace vl
{ {
writer.WriteString(prefix); writer.WriteString(prefix);
writer.WriteString(L"inline bool operator"); writer.WriteString(L"inline bool operator");
writer.WriteString(op.f0); writer.WriteString(op.get<0>());
writer.WriteString(L" (const "); writer.WriteString(L" (const ");
writer.WriteString(name); writer.WriteString(name);
writer.WriteString(L"& a, const "); writer.WriteString(L"& a, const ");
@@ -23387,12 +23385,12 @@ namespace vl
writer.WriteString(L" != b."); writer.WriteString(L" != b.");
writer.WriteString(ConvertName(member->name.value)); writer.WriteString(ConvertName(member->name.value));
writer.WriteString(L") return "); writer.WriteString(L") return ");
writer.WriteString(op.f1); writer.WriteString(op.get<1>());
writer.WriteLine(L";"); writer.WriteLine(L";");
} }
writer.WriteString(prefix); writer.WriteString(prefix);
writer.WriteString(L"\treturn "); writer.WriteString(L"\treturn ");
writer.WriteString(op.f2); writer.WriteString(op.get<2>());
writer.WriteLine(L";"); writer.WriteLine(L";");
writer.WriteString(prefix); writer.WriteString(prefix);
@@ -24902,7 +24900,7 @@ GenerateInstructions(Closure)
{ {
vint aId = wtoi(a->name.Sub(1, a->name.Length() - 1)); vint aId = wtoi(a->name.Sub(1, a->name.Length() - 1));
vint bId = wtoi(b->name.Sub(1, a->name.Length() - 1)); vint bId = wtoi(b->name.Sub(1, a->name.Length() - 1));
return aId - bId; return aId <=> bId;
}) })
); );
@@ -28955,10 +28953,8 @@ Licensed under https://github.com/vczh-libraries/License
***********************************************************************/ ***********************************************************************/
namespace vl namespace vl::workflow
{ {
namespace workflow
{
/*********************************************************************** /***********************************************************************
Visitor Pattern Implementation Visitor Pattern Implementation
***********************************************************************/ ***********************************************************************/
@@ -29402,14 +29398,9 @@ Visitor Pattern Implementation
{ {
visitor->Visit(this); visitor->Visit(this);
} }
}
} }
namespace vl namespace vl::reflection::description
{ {
namespace reflection
{
namespace description
{
#ifndef VCZH_DEBUG_NO_REFLECTION #ifndef VCZH_DEBUG_NO_REFLECTION
IMPL_TYPE_INFO_RENAME(vl::workflow::WfType, system::workflow::WfType) IMPL_TYPE_INFO_RENAME(vl::workflow::WfType, system::workflow::WfType)
@@ -30958,8 +30949,6 @@ namespace vl
#endif #endif
return false; return false;
} }
}
}
} }
@@ -30973,12 +30962,8 @@ Licensed under https://github.com/vczh-libraries/License
***********************************************************************/ ***********************************************************************/
namespace vl namespace vl::workflow::builder
{ {
namespace workflow
{
namespace builder
{
/*********************************************************************** /***********************************************************************
MakeAttachEventExpression MakeAttachEventExpression
@@ -32809,8 +32794,6 @@ MakeWhileStatement
node->statement = value; node->statement = value;
return *this; return *this;
} }
}
}
} }
@@ -32824,12 +32807,8 @@ Licensed under https://github.com/vczh-libraries/License
***********************************************************************/ ***********************************************************************/
namespace vl namespace vl::workflow::copy_visitor
{ {
namespace workflow
{
namespace copy_visitor
{
void AstVisitor::CopyFields(WfAttachEventExpression* from, WfAttachEventExpression* to) void AstVisitor::CopyFields(WfAttachEventExpression* from, WfAttachEventExpression* to)
{ {
CopyFields(static_cast<WfExpression*>(from), static_cast<WfExpression*>(to)); CopyFields(static_cast<WfExpression*>(from), static_cast<WfExpression*>(to));
@@ -35075,8 +35054,6 @@ namespace vl
return CopyNode(static_cast<WfStatement*>(node)).Cast<WfWhileStatement>(); return CopyNode(static_cast<WfStatement*>(node)).Cast<WfWhileStatement>();
} }
}
}
} }
@@ -35090,12 +35067,8 @@ Licensed under https://github.com/vczh-libraries/License
***********************************************************************/ ***********************************************************************/
namespace vl namespace vl::workflow::empty_visitor
{ {
namespace workflow
{
namespace empty_visitor
{
/*********************************************************************** /***********************************************************************
TypeVisitor TypeVisitor
@@ -35527,8 +35500,6 @@ ModuleUsingFragmentVisitor
void ModuleUsingFragmentVisitor::Visit(WfModuleUsingWildCardFragment* node) void ModuleUsingFragmentVisitor::Visit(WfModuleUsingWildCardFragment* node)
{ {
} }
}
}
} }
@@ -35542,12 +35513,8 @@ Licensed under https://github.com/vczh-libraries/License
***********************************************************************/ ***********************************************************************/
namespace vl namespace vl::workflow::json_visitor
{ {
namespace workflow
{
namespace json_visitor
{
void AstVisitor::PrintFields(WfAttachEventExpression* node) void AstVisitor::PrintFields(WfAttachEventExpression* node)
{ {
BeginField(L"event"); BeginField(L"event");
@@ -38558,8 +38525,6 @@ namespace vl
EndObject(); EndObject();
} }
}
}
} }
@@ -38573,12 +38538,8 @@ Licensed under https://github.com/vczh-libraries/License
***********************************************************************/ ***********************************************************************/
namespace vl namespace vl::workflow::traverse_visitor
{ {
namespace workflow
{
namespace traverse_visitor
{
void AstVisitor::Traverse(vl::glr::ParsingToken& token) {} void AstVisitor::Traverse(vl::glr::ParsingToken& token) {}
void AstVisitor::Traverse(vl::glr::ParsingAstBase* node) {} void AstVisitor::Traverse(vl::glr::ParsingAstBase* node) {}
void AstVisitor::Traverse(WfAttachEventExpression* node) {} void AstVisitor::Traverse(WfAttachEventExpression* node) {}
@@ -40289,8 +40250,6 @@ namespace vl
Finishing(static_cast<vl::glr::ParsingAstBase*>(node)); Finishing(static_cast<vl::glr::ParsingAstBase*>(node));
} }
}
}
} }
@@ -40304,10 +40263,8 @@ Licensed under https://github.com/vczh-libraries/License
***********************************************************************/ ***********************************************************************/
namespace vl namespace vl::workflow
{ {
namespace workflow
{
void WorkflowParserData(vl::stream::IStream& outputStream) void WorkflowParserData(vl::stream::IStream& outputStream)
{ {
static const vl::vint dataLength = 184886; // 3421018 bytes before compressing static const vl::vint dataLength = 184886; // 3421018 bytes before compressing
@@ -41949,72 +41906,76 @@ namespace vl
Parser::Parser() Parser::Parser()
: vl::glr::ParserBase<WorkflowTokens, ParserStates, WorkflowAstInsReceiver>(&WorkflowTokenDeleter, &WorkflowLexerData, &WorkflowParserData) : vl::glr::ParserBase<WorkflowTokens, ParserStates, WorkflowAstInsReceiver>(&WorkflowTokenDeleter, &WorkflowLexerData, &WorkflowParserData)
{ {
}; }
vl::WString Parser::GetClassName(vl::vint32_t classIndex) const
{
return vl::WString::Unmanaged(WorkflowTypeName((WorkflowClasses)classIndex));
}
vl::vint32_t Parser::FindCommonBaseClass(vl::vint32_t class1, vl::vint32_t class2) const vl::vint32_t Parser::FindCommonBaseClass(vl::vint32_t class1, vl::vint32_t class2) const
{ {
return -1; return -1;
}; }
vl::Ptr<vl::workflow::WfType> Parser::Parse_Type(const vl::WString& input, vl::vint codeIndex) const vl::Ptr<vl::workflow::WfType> Parser::Parse_Type(const vl::WString& input, vl::vint codeIndex) const
{ {
return ParseWithString<vl::workflow::WfType, ParserStates::_Type>(input, this, codeIndex); return ParseWithString<vl::workflow::WfType, ParserStates::_Type>(input, this, codeIndex);
}; }
vl::Ptr<vl::workflow::WfType> Parser::Parse_Type(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const vl::Ptr<vl::workflow::WfType> Parser::Parse_Type(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const
{ {
return ParseWithTokens<vl::workflow::WfType, ParserStates::_Type>(tokens, this, codeIndex); return ParseWithTokens<vl::workflow::WfType, ParserStates::_Type>(tokens, this, codeIndex);
}; }
vl::Ptr<vl::workflow::WfExpression> Parser::Parse_Expression(const vl::WString& input, vl::vint codeIndex) const vl::Ptr<vl::workflow::WfExpression> Parser::Parse_Expression(const vl::WString& input, vl::vint codeIndex) const
{ {
return ParseWithString<vl::workflow::WfExpression, ParserStates::_Expression>(input, this, codeIndex); return ParseWithString<vl::workflow::WfExpression, ParserStates::_Expression>(input, this, codeIndex);
}; }
vl::Ptr<vl::workflow::WfExpression> Parser::Parse_Expression(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const vl::Ptr<vl::workflow::WfExpression> Parser::Parse_Expression(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const
{ {
return ParseWithTokens<vl::workflow::WfExpression, ParserStates::_Expression>(tokens, this, codeIndex); return ParseWithTokens<vl::workflow::WfExpression, ParserStates::_Expression>(tokens, this, codeIndex);
}; }
vl::Ptr<vl::workflow::WfCoProviderStatement> Parser::Parse_CoProvider(const vl::WString& input, vl::vint codeIndex) const vl::Ptr<vl::workflow::WfCoProviderStatement> Parser::Parse_CoProvider(const vl::WString& input, vl::vint codeIndex) const
{ {
return ParseWithString<vl::workflow::WfCoProviderStatement, ParserStates::_CoProvider>(input, this, codeIndex); return ParseWithString<vl::workflow::WfCoProviderStatement, ParserStates::_CoProvider>(input, this, codeIndex);
}; }
vl::Ptr<vl::workflow::WfCoProviderStatement> Parser::Parse_CoProvider(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const vl::Ptr<vl::workflow::WfCoProviderStatement> Parser::Parse_CoProvider(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const
{ {
return ParseWithTokens<vl::workflow::WfCoProviderStatement, ParserStates::_CoProvider>(tokens, this, codeIndex); return ParseWithTokens<vl::workflow::WfCoProviderStatement, ParserStates::_CoProvider>(tokens, this, codeIndex);
}; }
vl::Ptr<vl::workflow::WfStatement> Parser::Parse_Statement(const vl::WString& input, vl::vint codeIndex) const vl::Ptr<vl::workflow::WfStatement> Parser::Parse_Statement(const vl::WString& input, vl::vint codeIndex) const
{ {
return ParseWithString<vl::workflow::WfStatement, ParserStates::_Statement>(input, this, codeIndex); return ParseWithString<vl::workflow::WfStatement, ParserStates::_Statement>(input, this, codeIndex);
}; }
vl::Ptr<vl::workflow::WfStatement> Parser::Parse_Statement(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const vl::Ptr<vl::workflow::WfStatement> Parser::Parse_Statement(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const
{ {
return ParseWithTokens<vl::workflow::WfStatement, ParserStates::_Statement>(tokens, this, codeIndex); return ParseWithTokens<vl::workflow::WfStatement, ParserStates::_Statement>(tokens, this, codeIndex);
}; }
vl::Ptr<vl::workflow::WfDeclaration> Parser::Parse_Declaration(const vl::WString& input, vl::vint codeIndex) const vl::Ptr<vl::workflow::WfDeclaration> Parser::Parse_Declaration(const vl::WString& input, vl::vint codeIndex) const
{ {
return ParseWithString<vl::workflow::WfDeclaration, ParserStates::_Declaration>(input, this, codeIndex); return ParseWithString<vl::workflow::WfDeclaration, ParserStates::_Declaration>(input, this, codeIndex);
}; }
vl::Ptr<vl::workflow::WfDeclaration> Parser::Parse_Declaration(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const vl::Ptr<vl::workflow::WfDeclaration> Parser::Parse_Declaration(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const
{ {
return ParseWithTokens<vl::workflow::WfDeclaration, ParserStates::_Declaration>(tokens, this, codeIndex); return ParseWithTokens<vl::workflow::WfDeclaration, ParserStates::_Declaration>(tokens, this, codeIndex);
}; }
vl::Ptr<vl::workflow::WfModule> Parser::Parse_Module(const vl::WString& input, vl::vint codeIndex) const vl::Ptr<vl::workflow::WfModule> Parser::Parse_Module(const vl::WString& input, vl::vint codeIndex) const
{ {
return ParseWithString<vl::workflow::WfModule, ParserStates::_Module>(input, this, codeIndex); return ParseWithString<vl::workflow::WfModule, ParserStates::_Module>(input, this, codeIndex);
}; }
vl::Ptr<vl::workflow::WfModule> Parser::Parse_Module(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const vl::Ptr<vl::workflow::WfModule> Parser::Parse_Module(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex) const
{ {
return ParseWithTokens<vl::workflow::WfModule, ParserStates::_Module>(tokens, this, codeIndex); return ParseWithTokens<vl::workflow::WfModule, ParserStates::_Module>(tokens, this, codeIndex);
};
} }
} }
@@ -42029,10 +41990,8 @@ Licensed under https://github.com/vczh-libraries/License
***********************************************************************/ ***********************************************************************/
namespace vl namespace vl::workflow
{ {
namespace workflow
{
/*********************************************************************** /***********************************************************************
WorkflowAstInsReceiver : public vl::glr::AstInsReceiverBase WorkflowAstInsReceiver : public vl::glr::AstInsReceiverBase
@@ -43315,7 +43274,6 @@ WorkflowAstInsReceiver : public vl::glr::AstInsReceiverBase
auto cppTypeName = WorkflowCppTypeName((WorkflowClasses)type); auto cppTypeName = WorkflowCppTypeName((WorkflowClasses)type);
return vl::glr::AssemblyThrowTypeNotAllowAmbiguity(type, cppTypeName); return vl::glr::AssemblyThrowTypeNotAllowAmbiguity(type, cppTypeName);
} }
}
} }
@@ -43329,10 +43287,8 @@ Licensed under https://github.com/vczh-libraries/License
***********************************************************************/ ***********************************************************************/
namespace vl namespace vl::workflow
{ {
namespace workflow
{
bool WorkflowTokenDeleter(vl::vint token) bool WorkflowTokenDeleter(vl::vint token)
{ {
switch((WorkflowTokens)token) switch((WorkflowTokens)token)
@@ -43746,6 +43702,5 @@ namespace vl
}; };
vl::glr::DecompressSerializedData(compressed, true, dataSolidRows, dataRows, dataBlock, dataRemain, outputStream); vl::glr::DecompressSerializedData(compressed, true, dataSolidRows, dataRows, dataBlock, dataRemain, outputStream);
} }
}
} }
+12 -59
View File
@@ -68,10 +68,8 @@ Licensed under https://github.com/vczh-libraries/License
#define VCZH_WORKFLOW_PARSER_AST_AST #define VCZH_WORKFLOW_PARSER_AST_AST
namespace vl namespace vl::workflow
{ {
namespace workflow
{
class WfAttachEventExpression; class WfAttachEventExpression;
class WfAttribute; class WfAttribute;
class WfAutoPropertyDeclaration; class WfAutoPropertyDeclaration;
@@ -1462,14 +1460,9 @@ namespace vl
vl::collections::List<vl::Ptr<WfModuleUsingPath>> paths; vl::collections::List<vl::Ptr<WfModuleUsingPath>> paths;
vl::collections::List<vl::Ptr<WfDeclaration>> declarations; vl::collections::List<vl::Ptr<WfDeclaration>> declarations;
}; };
}
} }
namespace vl namespace vl::reflection::description
{ {
namespace reflection
{
namespace description
{
#ifndef VCZH_DEBUG_NO_REFLECTION #ifndef VCZH_DEBUG_NO_REFLECTION
DECL_TYPE_INFO(vl::workflow::WfType) DECL_TYPE_INFO(vl::workflow::WfType)
DECL_TYPE_INFO(vl::workflow::WfType::IVisitor) DECL_TYPE_INFO(vl::workflow::WfType::IVisitor)
@@ -2098,8 +2091,6 @@ namespace vl
/// <summary>Load all reflectable AST types, only available when <b>VCZH_DEBUG_NO_REFLECTION</b> is off.</summary> /// <summary>Load all reflectable AST types, only available when <b>VCZH_DEBUG_NO_REFLECTION</b> is off.</summary>
/// <returns>Returns true if this operation succeeded.</returns> /// <returns>Returns true if this operation succeeded.</returns>
extern bool WorkflowAstLoadTypes(); extern bool WorkflowAstLoadTypes();
}
}
} }
#endif #endif
@@ -2116,12 +2107,8 @@ Licensed under https://github.com/vczh-libraries/License
#define VCZH_WORKFLOW_PARSER_AST_AST_BUILDER #define VCZH_WORKFLOW_PARSER_AST_AST_BUILDER
namespace vl namespace vl::workflow::builder
{ {
namespace workflow
{
namespace builder
{
class MakeAttachEventExpression : public vl::glr::ParsingAstBuilder<WfAttachEventExpression> class MakeAttachEventExpression : public vl::glr::ParsingAstBuilder<WfAttachEventExpression>
{ {
public: public:
@@ -2856,8 +2843,6 @@ namespace vl
MakeWhileStatement& statement(const vl::Ptr<WfStatement>& value); MakeWhileStatement& statement(const vl::Ptr<WfStatement>& value);
}; };
}
}
} }
#endif #endif
@@ -2874,12 +2859,8 @@ Licensed under https://github.com/vczh-libraries/License
#define VCZH_WORKFLOW_PARSER_AST_AST_COPY_VISITOR #define VCZH_WORKFLOW_PARSER_AST_AST_COPY_VISITOR
namespace vl namespace vl::workflow::copy_visitor
{ {
namespace workflow
{
namespace copy_visitor
{
/// <summary>A copy visitor, overriding all abstract methods with AST copying code.</summary> /// <summary>A copy visitor, overriding all abstract methods with AST copying code.</summary>
class AstVisitor class AstVisitor
: public virtual vl::glr::CopyVisitorBase : public virtual vl::glr::CopyVisitorBase
@@ -3237,8 +3218,6 @@ namespace vl
vl::Ptr<WfVirtualCseStatement> CopyNode(WfVirtualCseStatement* node); vl::Ptr<WfVirtualCseStatement> CopyNode(WfVirtualCseStatement* node);
vl::Ptr<WfWhileStatement> CopyNode(WfWhileStatement* node); vl::Ptr<WfWhileStatement> CopyNode(WfWhileStatement* node);
}; };
}
}
} }
#endif #endif
@@ -3255,12 +3234,8 @@ Licensed under https://github.com/vczh-libraries/License
#define VCZH_WORKFLOW_PARSER_AST_AST_EMPTY_VISITOR #define VCZH_WORKFLOW_PARSER_AST_AST_EMPTY_VISITOR
namespace vl namespace vl::workflow::empty_visitor
{ {
namespace workflow
{
namespace empty_visitor
{
/// <summary>An empty visitor, overriding all abstract methods with empty implementations.</summary> /// <summary>An empty visitor, overriding all abstract methods with empty implementations.</summary>
class TypeVisitor : public vl::Object, public WfType::IVisitor class TypeVisitor : public vl::Object, public WfType::IVisitor
{ {
@@ -3476,8 +3451,6 @@ namespace vl
void Visit(WfModuleUsingWildCardFragment* node) override; void Visit(WfModuleUsingWildCardFragment* node) override;
}; };
}
}
} }
#endif #endif
@@ -3494,12 +3467,8 @@ Licensed under https://github.com/vczh-libraries/License
#define VCZH_WORKFLOW_PARSER_AST_AST_JSON_VISITOR #define VCZH_WORKFLOW_PARSER_AST_AST_JSON_VISITOR
namespace vl namespace vl::workflow::json_visitor
{ {
namespace workflow
{
namespace json_visitor
{
/// <summary>A JSON visitor, overriding all abstract methods with AST to JSON serialization code.</summary> /// <summary>A JSON visitor, overriding all abstract methods with AST to JSON serialization code.</summary>
class AstVisitor class AstVisitor
: public vl::glr::JsonVisitorBase : public vl::glr::JsonVisitorBase
@@ -3753,8 +3722,6 @@ namespace vl
void Print(WfModuleUsingPath* node); void Print(WfModuleUsingPath* node);
void Print(WfModule* node); void Print(WfModule* node);
}; };
}
}
} }
#endif #endif
@@ -3771,12 +3738,8 @@ Licensed under https://github.com/vczh-libraries/License
#define VCZH_WORKFLOW_PARSER_AST_AST_TRAVERSE_VISITOR #define VCZH_WORKFLOW_PARSER_AST_AST_TRAVERSE_VISITOR
namespace vl namespace vl::workflow::traverse_visitor
{ {
namespace workflow
{
namespace traverse_visitor
{
/// <summary>A traverse visitor, overriding all abstract methods with AST visiting code.</summary> /// <summary>A traverse visitor, overriding all abstract methods with AST visiting code.</summary>
class AstVisitor class AstVisitor
: public vl::Object : public vl::Object
@@ -4142,8 +4105,6 @@ namespace vl
void InspectInto(WfModuleUsingPath* node); void InspectInto(WfModuleUsingPath* node);
void InspectInto(WfModule* node); void InspectInto(WfModule* node);
}; };
}
}
} }
#endif #endif
@@ -4160,10 +4121,8 @@ Licensed under https://github.com/vczh-libraries/License
#define VCZH_WORKFLOW_PARSER_AST_ASSEMBLER #define VCZH_WORKFLOW_PARSER_AST_ASSEMBLER
namespace vl namespace vl::workflow
{ {
namespace workflow
{
enum class WorkflowClasses : vl::vint32_t enum class WorkflowClasses : vl::vint32_t
{ {
AttachEventExpression = 0, AttachEventExpression = 0,
@@ -4492,7 +4451,6 @@ namespace vl
void SetField(vl::glr::ParsingAstBase* object, vl::vint32_t field, vl::vint32_t enumItem, bool weakAssignment) override; void SetField(vl::glr::ParsingAstBase* object, vl::vint32_t field, vl::vint32_t enumItem, bool weakAssignment) override;
vl::Ptr<vl::glr::ParsingAstBase> ResolveAmbiguity(vl::vint32_t type, vl::collections::Array<vl::Ptr<vl::glr::ParsingAstBase>>& candidates) override; vl::Ptr<vl::glr::ParsingAstBase> ResolveAmbiguity(vl::vint32_t type, vl::collections::Array<vl::Ptr<vl::glr::ParsingAstBase>>& candidates) override;
}; };
}
} }
#endif #endif
@@ -4509,10 +4467,8 @@ Licensed under https://github.com/vczh-libraries/License
#define VCZH_WORKFLOW_PARSER_LEXER #define VCZH_WORKFLOW_PARSER_LEXER
namespace vl namespace vl::workflow
{ {
namespace workflow
{
enum class WorkflowTokens : vl::vint32_t enum class WorkflowTokens : vl::vint32_t
{ {
EXP = 0, EXP = 0,
@@ -4638,7 +4594,6 @@ namespace vl
extern const wchar_t* WorkflowTokenDisplayText(WorkflowTokens token); extern const wchar_t* WorkflowTokenDisplayText(WorkflowTokens token);
extern const wchar_t* WorkflowTokenRegex(WorkflowTokens token); extern const wchar_t* WorkflowTokenRegex(WorkflowTokens token);
extern void WorkflowLexerData(vl::stream::IStream& outputStream); extern void WorkflowLexerData(vl::stream::IStream& outputStream);
}
} }
#endif #endif
@@ -4655,10 +4610,8 @@ Licensed under https://github.com/vczh-libraries/License
#define VCZH_WORKFLOW_PARSER_PARSER_SYNTAX #define VCZH_WORKFLOW_PARSER_PARSER_SYNTAX
namespace vl namespace vl::workflow
{ {
namespace workflow
{
enum class ParserStates enum class ParserStates
{ {
_Type = 0, _Type = 0,
@@ -4743,6 +4696,7 @@ namespace vl
, protected vl::glr::automaton::IExecutor::ITypeCallback , protected vl::glr::automaton::IExecutor::ITypeCallback
{ {
protected: protected:
vl::WString GetClassName(vl::vint32_t classIndex) const override;
vl::vint32_t FindCommonBaseClass(vl::vint32_t class1, vl::vint32_t class2) const override; vl::vint32_t FindCommonBaseClass(vl::vint32_t class1, vl::vint32_t class2) const override;
public: public:
Parser(); Parser();
@@ -4760,7 +4714,6 @@ namespace vl
vl::Ptr<vl::workflow::WfModule> Parse_Module(const vl::WString& input, vl::vint codeIndex = -1) const; vl::Ptr<vl::workflow::WfModule> Parse_Module(const vl::WString& input, vl::vint codeIndex = -1) const;
vl::Ptr<vl::workflow::WfModule> Parse_Module(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex = -1) const; vl::Ptr<vl::workflow::WfModule> Parse_Module(vl::collections::List<vl::regex::RegexToken>& tokens, vl::vint codeIndex = -1) const;
}; };
}
} }
#endif #endif
@@ -5828,7 +5781,7 @@ namespace vl
{ {
auto tdA = manager->declarationTypes[a.Obj()].Obj(); auto tdA = manager->declarationTypes[a.Obj()].Obj();
auto tdB = manager->declarationTypes[b.Obj()].Obj(); auto tdB = manager->declarationTypes[b.Obj()].Obj();
return WString::Compare(tdA->GetTypeName(), tdB->GetTypeName()); return tdA->GetTypeName() <=> tdB->GetTypeName();
}); });
} }
+4 -4
View File
@@ -2826,9 +2826,9 @@ WfDebugger BreakPoints
PropertyKey key1(breakPoint.thisObject, breakPoint.propertyInfo); PropertyKey key1(breakPoint.thisObject, breakPoint.propertyInfo);
MethodKey key2(breakPoint.thisObject, breakPoint.propertyInfo->GetGetter()); MethodKey key2(breakPoint.thisObject, breakPoint.propertyInfo->GetGetter());
TEST(true, key1, getPropertyBreakPoints); TEST(true, key1, getPropertyBreakPoints);
TEST(key2.f1, key2, invokeMethodBreakPoints); TEST(key2.get<1>(), key2, invokeMethodBreakPoints);
SET(key1, getPropertyBreakPoints); SET(key1, getPropertyBreakPoints);
SETC(key2.f1, key2, invokeMethodBreakPoints); SETC(key2.get<1>(), key2, invokeMethodBreakPoints);
} }
break; break;
case WfBreakPoint::SetProperty: case WfBreakPoint::SetProperty:
@@ -2836,9 +2836,9 @@ WfDebugger BreakPoints
PropertyKey key1(breakPoint.thisObject, breakPoint.propertyInfo); PropertyKey key1(breakPoint.thisObject, breakPoint.propertyInfo);
MethodKey key2(breakPoint.thisObject, breakPoint.propertyInfo->GetSetter()); MethodKey key2(breakPoint.thisObject, breakPoint.propertyInfo->GetSetter());
TEST(true, key1, setPropertyBreakPoints); TEST(true, key1, setPropertyBreakPoints);
TEST(key2.f1, key2, invokeMethodBreakPoints); TEST(key2.get<1>(), key2, invokeMethodBreakPoints);
SET(key1, setPropertyBreakPoints); SET(key1, setPropertyBreakPoints);
SETC(key2.f1, key2, invokeMethodBreakPoints); SETC(key2.get<1>(), key2, invokeMethodBreakPoints);
} }
break; break;
case WfBreakPoint::AttachEvent: case WfBreakPoint::AttachEvent:
@@ -29,11 +29,9 @@ void CollectConditions(
vint index = conditions.Keys().IndexOf(file); vint index = conditions.Keys().IndexOf(file);
if (index != -1) if (index != -1)
{ {
const auto& tuples = conditions.GetByIndex(index); for (auto [condition, path] : conditions.GetByIndex(index))
for (vint i = 0; i < tuples.Count(); i++)
{ {
auto condition = tuples[i].f0; auto includeFile = inputFileToOutputFiles[path];
auto includeFile = inputFileToOutputFiles[tuples[i].f1];
if (!categorizedConditions.Contains(condition, includeFile)) if (!categorizedConditions.Contains(condition, includeFile))
{ {
categorizedConditions.Add(condition, includeFile); categorizedConditions.Add(condition, includeFile);
+15 -15
View File
@@ -40,15 +40,15 @@ int main(int argc, char* argv[])
CopyFrom( CopyFrom(
categorizedOutput, categorizedOutput,
XmlGetElements(XmlGetElement(config->rootElement, L"output"), L"codepair") XmlGetElements(XmlGetElement(config->rootElement, L"output"), L"codepair")
.Select([&](Ptr<XmlElement> e)->Pair<WString, Tuple<WString, bool>> .Select([&](Ptr<XmlElement> e)
{ {
return { return Pair(
XmlGetAttribute(e, L"category")->value.value, XmlGetAttribute(e, L"category")->value.value,
{ Tuple(
XmlGetAttribute(e, L"filename")->value.value, XmlGetAttribute(e, L"filename")->value.value,
XmlGetAttribute(e, L"generate")->value.value == L"true" XmlGetAttribute(e, L"generate")->value.value == L"true"
} )
}; );
}) })
); );
} }
@@ -113,7 +113,7 @@ int main(int argc, char* argv[])
Dictionary<WString, FilePath> skippedImportFiles; // file name -> file path Dictionary<WString, FilePath> skippedImportFiles; // file name -> file path
for (vint i = 0; i < categorizedOutput.Count(); i++) for (vint i = 0; i < categorizedOutput.Count(); i++)
{ {
if (!categorizedOutput.Values()[i].f1) if (!categorizedOutput.Values()[i].get<1>())
{ {
auto category = categorizedOutput.Keys()[i]; auto category = categorizedOutput.Keys()[i];
for (auto skippedImportFile : categorizedHeaderFiles[category]) for (auto skippedImportFile : categorizedHeaderFiles[category])
@@ -206,7 +206,7 @@ int main(int argc, char* argv[])
{ {
auto key = inputFileToCategories.Keys()[i]; auto key = inputFileToCategories.Keys()[i];
auto value = inputFileToCategories.Values()[i]; auto value = inputFileToCategories.Values()[i];
inputFileToOutputFiles.Add(key, categorizedOutput[value].f0); inputFileToOutputFiles.Add(key, categorizedOutput[value].get<0>());
} }
} }
@@ -233,7 +233,7 @@ int main(int argc, char* argv[])
}) })
.Select([&](vint nodeIndex) .Select([&](vint nodeIndex)
{ {
return categorizedOutput[componentToCategoryNames[popCategories.nodes[nodeIndex].component][0]].f0 + L".h"; return categorizedOutput[componentToCategoryNames[popCategories.nodes[nodeIndex].component][0]].get<0>() + L".h";
}) })
); );
} }
@@ -243,13 +243,13 @@ int main(int argc, char* argv[])
for (vint i = 0; i < popCategories.components.Count(); i++) for (vint i = 0; i < popCategories.components.Count(); i++)
{ {
auto categoryName = componentToCategoryNames[i][0]; auto categoryName = componentToCategoryNames[i][0];
auto outputPath = outputFolder / (categorizedOutput[categoryName].f0 + L".h"); auto outputPath = outputFolder / (categorizedOutput[categoryName].get<0>() + L".h");
auto outputIncludeOnlyPath = outputIncludeOnlyFolder / (categorizedOutput[categoryName].f0 + L".h"); auto outputIncludeOnlyPath = outputIncludeOnlyFolder / (categorizedOutput[categoryName].get<0>() + L".h");
auto systemIncludes = Ptr(new SortedList<WString>); auto systemIncludes = Ptr(new SortedList<WString>);
categorizedSystemIncludes.Add(categoryName, systemIncludes); categorizedSystemIncludes.Add(categoryName, systemIncludes);
if (categorizedOutput[categoryName].f1) if (categorizedOutput[categoryName].get<1>())
{ {
vint headerIndex = categorizedHeaderFiles.Keys().IndexOf(categoryName); vint headerIndex = categorizedHeaderFiles.Keys().IndexOf(categoryName);
if (headerIndex == -1) continue; if (headerIndex == -1) continue;
@@ -272,13 +272,13 @@ int main(int argc, char* argv[])
for (vint i = 0; i < popCategories.components.Count(); i++) for (vint i = 0; i < popCategories.components.Count(); i++)
{ {
auto categoryName = componentToCategoryNames[i][0]; auto categoryName = componentToCategoryNames[i][0];
if (categorizedOutput[categoryName].f1) if (categorizedOutput[categoryName].get<1>())
{ {
WString outputHeader[] = { categorizedOutput[categoryName].f0 + L".h" }; WString outputHeader[] = { categorizedOutput[categoryName].get<0>() + L".h"};
vint headerIndex = categorizedHeaderFiles.Keys().IndexOf(categoryName); vint headerIndex = categorizedHeaderFiles.Keys().IndexOf(categoryName);
auto outputPath = outputFolder / (categorizedOutput[categoryName].f0 + L".cpp"); auto outputPath = outputFolder / (categorizedOutput[categoryName].get<0>() + L".cpp");
auto outputIncludeOnlyPath = outputIncludeOnlyFolder / (categorizedOutput[categoryName].f0 + L".cpp"); auto outputIncludeOnlyPath = outputIncludeOnlyFolder / (categorizedOutput[categoryName].get<0>() + L".cpp");
Combine( Combine(
inputFileToOutputFiles, inputFileToOutputFiles,
skippedImportFiles, skippedImportFiles,
-33
View File
@@ -321,39 +321,6 @@ int main(int argc, char* argv[])
syntaxManager.BuildAutomaton(lexerManager.Tokens().Count(), executable, metadata); syntaxManager.BuildAutomaton(lexerManager.Tokens().Count(), executable, metadata);
EXIT_IF_COMPILE_FAIL(global); EXIT_IF_COMPILE_FAIL(global);
for (auto elementExport : XmlGetElements(elementSyntax, L"Export"))
{
WString rule;
READ_ATTRIBUTE(rule, elementExport, L"rule", L"/Parser/Syntax@file[@name=\"" + name + L"\"]/Export@rule");
vint index = syntaxManager.Rules().Keys().IndexOf(rule);
if (index == -1)
{
EXIT_ERROR(L"Rule \"" + rule + L"\" is not defined in the syntax.");
}
auto ruleSymbol = syntaxManager.Rules().Values()[index];
syntaxManager.parsableRules.Add(ruleSymbol);
if (auto attType = XmlGetAttribute(elementExport, L"type"))
{
syntaxManager.ruleTypes.Add(ruleSymbol, attType->value.value);
}
else
{
auto classSymbol = ruleSymbol->ruleType;
auto classFile = classSymbol->Owner();
auto type =
From(classFile->cppNss)
.Reverse()
.Aggregate(
classFile->classPrefix + classSymbol->Name(),
[](auto&& a, auto&& b) { return b + L"::" + a; }
);
syntaxManager.ruleTypes.Add(ruleSymbol, type);
}
}
GenerateSyntaxFileNames(syntaxManager, output); GenerateSyntaxFileNames(syntaxManager, output);
WriteSyntaxFiles(syntaxManager, executable, metadata, output, files); WriteSyntaxFiles(syntaxManager, executable, metadata, output, files);
} }
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.