Server Tags

Introduction

Plug-in servers are self-describing. The first aspect of their identity is their server class and name. The class indicates what function they perform (Loader, Saver, Command, etc.) and the name uniquely identifies that server among all servers of the same class.

The second part of the self-description are the server tags. A tag is a pair of strings that are the name & value of some attribute, and each server can support multiple tag attributes. Although tags are read from servers the first time they are loaded, they are also cached in the config file. This allows nexus to keep track of the attributes of servers so that they can remain unloaded until absolutely required.

Standard Tags

All servers support some command tags. The LXsSRV_USERNAME tag can give a human-readable version of the internal name. This is something of a legacy tag since it doesn’t allow for internationalization, making it suitable only for names that don’t need translation, like proper names.

The LXsSRV_LICENSE tag can give a value for a license required to load the plug-in. This is a license in nexus format, so it requires a contract with Luxology to generate appropriate licenses. See the reference docs for details.

The LXsSRV_LOGSUBSYSTEM tag indicates the name or names of log subsystems that will be used for output from the server.

All other tags are specific to the server class. See the Server Basics for each server type for details on available tags.

Declaring Tags

StaticDesc Implementation

Tags can be most easily added by defining a descInfo array in the C++ server class:

1
2
3
4
5
 class CMyLoader
 {
         static LXtTagInfoDesc   descInfo[];
         ...
 };

The contents of the array must be declaring statically, and is terminated with a null name:

1
2
3
4
5
6
 LXtTagInfoDesc  CMyLoader::descInfo[] = {
         { LXsSRV_USERNAME,     "Ultra JPEG"    },
         { LXsSAV_CLASSLIST,    LXa_IMAGE       },
         { LXsSAV_DOSPATTERN,   "*.jpg;*.jpeg"  },
         { 0 }
 };

Finally the server polymorph wrapper has to implement the StaticDesc implementation.

1
         srv->AddInterface (new CLxIfc_StaticDesc<CMyLoader>);

TagDescription Implementation

The StaticDesc wrapper actually works by adding a TagDescription Interface to the server’s exported interfaces. This can be done directly instead of using the static array wrapper.

1
2
3
4
5
6
7
 class CMyLoader :
         public CLxImpl_TagDescription
 {
         unsigned      tag_Count ()                                 LXx_OVERRIDE;
         LxResult      tag_Describe (unsigned, LXtTagInfoDesc *)    LXx_OVERRIDE;
         ...
 };

The Count() method returns the number of tags, and the Describe() method returns the tag/value pairs by index.

1
2
3
4
5
         unsigned
 CMyLoader::tag_Count ()
 {
         return 2;
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
         LxResult
 CMyLoader::tag_Describe (
         unsigned                index,
         LXtTagInfoDesc         *desc)
 {
         if (index == 0) {
                 desc.type = LXsSAV_CLASSLIST;
                 desc.info = LXa_IMAGE;
         } else if (index == 1)
                 desc.type = LXsSAV_DOSPATTERN;
                 desc.info = "*.jpg;*.jpeg";
         } else
                 return LXe_OUTOFBOUNDS;
1
2
         return LXe_OK;
 }

Per usual the interface has to be presented by the polymorph.

1
         srv->AddInterface (new CLxIfc_TagDescription<CMyLoader>);