Back to index

tetex-bin  3.0
Public Member Functions | Static Public Member Functions | Private Attributes
LinkURI Class Reference

#include <Link.h>

Inheritance diagram for LinkURI:
Inheritance graph
[legend]
Collaboration diagram for LinkURI:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LinkURI (Object *uriObj, GString *baseURI)
virtual ~LinkURI ()
virtual GBool isOk ()
virtual LinkActionKind getKind ()
GStringgetURI ()

Static Public Member Functions

static LinkActionparseDest (Object *obj)
static LinkActionparseAction (Object *obj, GString *baseURI=NULL)
static GStringgetFileSpecName (Object *fileSpecObj)

Private Attributes

GStringuri

Detailed Description

Definition at line 212 of file Link.h.


Constructor & Destructor Documentation

LinkURI::LinkURI ( Object uriObj,
GString baseURI 
)

Definition at line 492 of file Link.cc.

                                                 {
  GString *uri2;
  int n;
  char c;

  uri = NULL;
  if (uriObj->isString()) {
    uri2 = uriObj->getString()->copy();
    if (baseURI) {
      n = strcspn(uri2->getCString(), "/:");
      if (n == uri2->getLength() || uri2->getChar(n) == '/') {
       uri = baseURI->copy();
       c = uri->getChar(uri->getLength() - 1);
       if (c == '/' || c == '?') {
         if (uri2->getChar(0) == '/') {
           uri2->del(0);
         }
       } else {
         if (uri2->getChar(0) != '/') {
           uri->append('/');
         }
       }
       uri->append(uri2);
       delete uri2;
      } else {
       uri = uri2;
      }
    } else {
      uri = uri2;
    }
  } else {
    error(-1, "Illegal URI-type link");
  }
}

Here is the call graph for this function:

LinkURI::~LinkURI ( ) [virtual]

Definition at line 527 of file Link.cc.

                  {
  if (uri)
    delete uri;
}

Member Function Documentation

GString * LinkAction::getFileSpecName ( Object fileSpecObj) [static, inherited]

Definition at line 108 of file Link.cc.

                                                        {
  GString *name;
  Object obj1;

  name = NULL;

  // string
  if (fileSpecObj->isString()) {
    name = fileSpecObj->getString()->copy();

  // dictionary
  } else if (fileSpecObj->isDict()) {
    if (!fileSpecObj->dictLookup("Unix", &obj1)->isString()) {
      obj1.free();
      fileSpecObj->dictLookup("F", &obj1);
    }
    if (obj1.isString())
      name = obj1.getString()->copy();
    else
      error(-1, "Illegal file spec in link");
    obj1.free();

  // error
  } else {
    error(-1, "Illegal file spec in link");
  }

  return name;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual LinkActionKind LinkURI::getKind ( ) [inline, virtual]

Implements LinkAction.

Definition at line 225 of file Link.h.

{ return actionURI; }
GString* LinkURI::getURI ( ) [inline]

Definition at line 226 of file Link.h.

{ return uri; }
virtual GBool LinkURI::isOk ( ) [inline, virtual]

Implements LinkAction.

Definition at line 222 of file Link.h.

{ return uri != NULL; }
LinkAction * LinkAction::parseAction ( Object obj,
GString baseURI = NULL 
) [static, inherited]

Definition at line 40 of file Link.cc.

                                                                 {
  LinkAction *action;
  Object obj2, obj3, obj4;

  if (!obj->isDict()) {
    error(-1, "Bad annotation action");
    return NULL;
  }

  obj->dictLookup("S", &obj2);

  // GoTo action
  if (obj2.isName("GoTo")) {
    obj->dictLookup("D", &obj3);
    action = new LinkGoTo(&obj3);
    obj3.free();

  // GoToR action
  } else if (obj2.isName("GoToR")) {
    obj->dictLookup("F", &obj3);
    obj->dictLookup("D", &obj4);
    action = new LinkGoToR(&obj3, &obj4);
    obj3.free();
    obj4.free();

  // Launch action
  } else if (obj2.isName("Launch")) {
    action = new LinkLaunch(obj);

  // URI action
  } else if (obj2.isName("URI")) {
    obj->dictLookup("URI", &obj3);
    action = new LinkURI(&obj3, baseURI);
    obj3.free();

  // Named action
  } else if (obj2.isName("Named")) {
    obj->dictLookup("N", &obj3);
    action = new LinkNamed(&obj3);
    obj3.free();

  // Movie action
  } else if (obj2.isName("Movie")) {
    obj->dictLookupNF("Annot", &obj3);
    obj->dictLookup("T", &obj4);
    action = new LinkMovie(&obj3, &obj4);
    obj3.free();
    obj4.free();

  // unknown action
  } else if (obj2.isName()) {
    action = new LinkUnknown(obj2.getName());

  // action is missing or wrong type
  } else {
    error(-1, "Bad annotation action");
    action = NULL;
  }

  obj2.free();

  if (action && !action->isOk()) {
    delete action;
    return NULL;
  }
  return action;
}

Here is the call graph for this function:

Here is the caller graph for this function:

LinkAction * LinkAction::parseDest ( Object obj) [static, inherited]

Definition at line 29 of file Link.cc.

                                             {
  LinkAction *action;

  action = new LinkGoTo(obj);
  if (!action->isOk()) {
    delete action;
    return NULL;
  }
  return action;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

GString* LinkURI::uri [private]

Definition at line 230 of file Link.h.


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