Remoto - VFS: VFS_node_interface.cpp Source File
Remoto - VFS
VFS_node_interface.cpp
Go to the documentation of this file.
1 
2 #include "VFS_node_interface.h"
3 
89 : _remote(remoteNode != nullptr)
90 , _remoteNode(remoteNode)
91 {
92 }
93 
95 {
96 }
97 
98 
121 {
122  return QString("No description available for '%1' nodes.").arg(type);
123 }
124 
147 {
148  return QString("No constructor signature available for '%1' nodes.").arg(type);
149 }
150 
151 
185 {
186  return true;
187 }
188 
195 {
196  QStringList p = provides();
197  QString s;
198 
199  for (int i=0;i<p.length();i++)
200  {
201  QString n = p[i];
202  s += QString(" %1 - %2\n").arg(n,-20).arg(description(n));
203 
204  QString a = arguments(n);
205  QStringList as = a.split('\n',Qt::SkipEmptyParts);
206  s += QString("%1").arg("",-27) + as.join( QString("\n%1").arg(' ',-27) ) + "\n";
207  s += "\n";
208  }
209 
210  return s;
211 }
212 
213 
225 {
226  Q_UNUSED(type)
227 
228  return true; //or do we default to unlicensed?
229 }
230 
240 {
241  return QStringList();
242 }
243 
255 VFS_node *VFS_node_interface::create(QString type, QVariantMap env, QDomElement child)
256 {
257  Q_UNUSED(type)
258  Q_UNUSED(env)
259  Q_UNUSED(child)
260 
261  return nullptr;
262 }
263 
283 QString VFS_node_interface::code(QString nodename, QString libname, QString &error)
284 {
285  return VFS_node::code(nodename,libname,error);
286 }
287 
288 
298 {
299  QString a;
300 
301  int c = s.constructorCount();
302  c = qMin(1,c);
303 
304  if (c == 0)
305  return QString("No constructor signature available for '%1' nodes.").arg(s.className());
306 
307 
308  for (int i=0;i<c;i++)
309  {
310  QString ctor;
311 
312  QMetaMethod m = s.constructor(i);
313 
314  ctor += m.name() + "(";
315 
316  //printf("ctor %d: %s %s %d\n",i,qUtf8Printable(m.name()),qUtf8Printable(m.methodSignature()),m.parameterCount());
317 
318  int nc = m.parameterCount();
319  QList<QByteArray> pn = m.parameterNames();
320  QList<QByteArray> pt = m.parameterTypes();
321  for (int j=0;j<nc;j++)
322  {
323  ctor += pt.at(j) + " " + pn.at(j);
324  if (j < nc-1)
325  ctor += ", ";
326  }
327 
328  ctor += ")\n";
329 
330  a += ctor;
331  }
332 
333  return a;
334 }
335 
336 
343 {
344  return _remote;
345 }
346 
355 {
356  return _remoteNode;
357 }
virtual QString description(QString type)
Descriptive text about an individual node.
bool isRemote()
If a plugin represents a remote resource, this value will be true.
virtual bool initialize()
The plugin initializer.
VFS_node_interface(VFS_node *remoteNode=nullptr)
VFS_node_interface::VFS_node_interface.
QString argumentString(QMetaObject s)
Format a constructor string based on a node's metadata object.
bool _remote
Does this plugin exist on another resource?
virtual bool licensed(QString type)
A licensing mechanism for node creation.
QString describe()
Describe all the nodes in a plugin.
virtual QString arguments(QString type)
Describe the arguments needed to create a node.
VFS_node * _remoteNode
The node responding to requests for remote resources.
virtual QString code(QString nodename, QString libname, QString &error)
Request code or other resource from a plugin bundle.
virtual QStringList provides()
A string list of node names that this plugin is prepared to create.
VFS_node * remoteNode()
Return the node needed to satisfy a remote request.
virtual VFS_node * create(QString type, QVariantMap env, QDomElement child)
Create a new node instance.
VFS_node is the base class from which all other VFS_node classes derive.
Definition: VFS_node.h:143
static QString code(QString nodename, QString libname, QString &error)
Fetch code or any other resource from a node.
Definition: VFS_node.cpp:1038
setter type
a setter DOCME
setter error
Set the error value of this widget.