Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
detail::PluginValidationResult Class Referencefinal

#include <PluginIPCUtils.h>

Inheritance diagram for detail::PluginValidationResult:
[legend]
Collaboration diagram for detail::PluginValidationResult:
[legend]

Public Member Functions

bool IsValid () const noexcept
 
bool HasError () const noexcept
 
const wxString & GetErrorMessage () const noexcept
 
void Add (PluginDescriptor &&desc)
 
void SetError (const wxString &msg)
 
const std::vector< PluginDescriptor > & GetDescriptors () const noexcept
 
bool HandleXMLTag (const std::string_view &tag, const AttributesList &attrs) override
 
void HandleXMLEndTag (const std::string_view &) override
 
XMLTagHandlerHandleXMLChild (const std::string_view &tag) override
 
void WriteXML (XMLWriter &writer) const
 
- Public Member Functions inherited from XMLTagHandler
 XMLTagHandler ()
 
virtual ~XMLTagHandler ()
 
virtual bool HandleXMLTag (const std::string_view &tag, const AttributesList &attrs)=0
 
virtual void HandleXMLEndTag (const std::string_view &WXUNUSED(tag))
 
virtual void HandleXMLContent (const std::string_view &WXUNUSED(content))
 
virtual XMLTagHandlerHandleXMLChild (const std::string_view &tag)=0
 
void ReadXMLEndTag (const char *tag)
 
void ReadXMLContent (const char *s, int len)
 
XMLTagHandlerReadXMLChild (const char *tag)
 

Private Attributes

std::vector< PluginDescriptormDescriptors
 
wxString mErrorMessage
 
bool mHasError {false}
 

Detailed Description

Host uses this structure to build a response and store it into xml form before sending to the other side. Main application uses this structure to restore response from the xml document received as a message

Definition at line 59 of file PluginIPCUtils.h.

Member Function Documentation

◆ Add()

void PluginValidationResult::Add ( PluginDescriptor &&  desc)

Definition at line 102 of file PluginIPCUtils.cpp.

103{
104 mDescriptors.push_back(std::move(desc));
105}
const TranslatableString desc
Definition: ExportPCM.cpp:55
std::vector< PluginDescriptor > mDescriptors

References desc, and mDescriptors.

Referenced by anonymous_namespace{PluginHost.cpp}::Discover().

Here is the caller graph for this function:

◆ GetDescriptors()

const std::vector< PluginDescriptor > & PluginValidationResult::GetDescriptors ( ) const
noexcept

Definition at line 113 of file PluginIPCUtils.cpp.

114{
115 return mDescriptors;
116}

References mDescriptors.

◆ GetErrorMessage()

const wxString & PluginValidationResult::GetErrorMessage ( ) const
noexcept

Definition at line 97 of file PluginIPCUtils.cpp.

98{
99 return mErrorMessage;
100}

References mErrorMessage.

◆ HandleXMLChild()

XMLTagHandler * PluginValidationResult::HandleXMLChild ( const std::string_view &  tag)
overridevirtual

Implements XMLTagHandler.

Definition at line 135 of file PluginIPCUtils.cpp.

136{
138 {
139 mDescriptors.resize(mDescriptors.size() + 1);
140 return &mDescriptors.back();
141 }
142 return nullptr;
143}
static constexpr auto XMLNodeName

References mDescriptors, and PluginDescriptor::XMLNodeName.

◆ HandleXMLEndTag()

void PluginValidationResult::HandleXMLEndTag ( const std::string_view &  )
override

Definition at line 133 of file PluginIPCUtils.cpp.

133{ }

◆ HandleXMLTag()

bool PluginValidationResult::HandleXMLTag ( const std::string_view &  tag,
const AttributesList attrs 
)
overridevirtual

Implements XMLTagHandler.

Definition at line 118 of file PluginIPCUtils.cpp.

119{
120 if(tag == NodeError)
121 {
122 mHasError = true;
123 for(auto& p : attrs)
124 {
125 auto key = wxString(p.first.data(), p.first.length());
126 auto& attr = p.second;
127 if(key == AttrErrorMessage)
128 mErrorMessage = attr.ToWString();
129 }
130 }
131 return true;
132}
static const AudacityProject::AttachedObjects::RegisteredFactory key

References anonymous_namespace{PluginIPCUtils.cpp}::AttrErrorMessage, key, mErrorMessage, mHasError, and anonymous_namespace{PluginIPCUtils.cpp}::NodeError.

◆ HasError()

bool PluginValidationResult::HasError ( ) const
noexcept

Definition at line 92 of file PluginIPCUtils.cpp.

93{
94 return mHasError;
95}

References mHasError.

◆ IsValid()

bool PluginValidationResult::IsValid ( ) const
noexcept

Result is valid if error flag was not set and contains at least one plugin descriptor.

Definition at line 87 of file PluginIPCUtils.cpp.

88{
89 return !mHasError && !mDescriptors.empty();
90}

References mDescriptors, and mHasError.

◆ SetError()

void PluginValidationResult::SetError ( const wxString &  msg)

Definition at line 107 of file PluginIPCUtils.cpp.

108{
109 mHasError = true;
110 mErrorMessage = msg;
111}

References mErrorMessage, and mHasError.

Referenced by anonymous_namespace{PluginHost.cpp}::Discover(), AsyncPluginValidator::Impl::OnDisconnect(), and PluginHost::Serve().

Here is the caller graph for this function:

◆ WriteXML()

void PluginValidationResult::WriteXML ( XMLWriter writer) const

Definition at line 145 of file PluginIPCUtils.cpp.

146{
147 if(mHasError)
148 {
149 writer.StartTag(NodeError);
151 writer.EndTag(NodeError);
152 }
153 if(!mDescriptors.empty())
154 {
155 writer.StartTag(NodePlugin);
156 for(auto& desc : mDescriptors)
157 desc.WriteXML(writer);
158 writer.EndTag(NodePlugin);
159 }
160}
virtual void StartTag(const wxString &name)
Definition: XMLWriter.cpp:79
void WriteAttr(const wxString &name, const Identifier &value)
Definition: XMLWriter.h:37
virtual void EndTag(const wxString &name)
Definition: XMLWriter.cpp:102

References anonymous_namespace{PluginIPCUtils.cpp}::AttrErrorMessage, desc, XMLWriter::EndTag(), mDescriptors, mErrorMessage, mHasError, anonymous_namespace{PluginIPCUtils.cpp}::NodeError, anonymous_namespace{PluginIPCUtils.cpp}::NodePlugin, XMLWriter::StartTag(), and XMLWriter::WriteAttr().

Referenced by PluginHost::Serve().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mDescriptors

std::vector<PluginDescriptor> detail::PluginValidationResult::mDescriptors
private

Definition at line 61 of file PluginIPCUtils.h.

Referenced by Add(), GetDescriptors(), HandleXMLChild(), IsValid(), and WriteXML().

◆ mErrorMessage

wxString detail::PluginValidationResult::mErrorMessage
private

Definition at line 62 of file PluginIPCUtils.h.

Referenced by GetErrorMessage(), HandleXMLTag(), SetError(), and WriteXML().

◆ mHasError

bool detail::PluginValidationResult::mHasError {false}
private

Definition at line 63 of file PluginIPCUtils.h.

Referenced by HandleXMLTag(), HasError(), IsValid(), SetError(), and WriteXML().


The documentation for this class was generated from the following files: