Lolly 1.4.27
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Friends | List of all members
url Class Reference

#include <url.hpp>

Inheritance diagram for url:
Inheritance graph
[legend]

Public Member Functions

 url ()
 
 url (const char *name)
 
 url (string name)
 
 url (string dir, string name)
 
bool operator== (url u)
 
bool operator!= (url u)
 
url operator[] (int i)
 
string label ()
 
string protocol ()
 

Private Member Functions

 CONCRETE (url)
 
 url (url_tree t)
 

Friends

url as_url (url_tree t)
 

Detailed Description

Definition at line 37 of file url.hpp.

Constructor & Destructor Documentation

◆ url() [1/5]

url::url ( url_tree t)
inlineprivate

Definition at line 41 of file url.hpp.

41: rep (tm_new<url_rep> (t)) {}
blackbox t[13]
The list class represents a linked list.
Definition list.hpp:48
base class of resources
Definition resource.hpp:23

◆ url() [2/5]

url::url ( )

Definition at line 60 of file url.cpp.

60: rep (tm_new<url_rep> (url_tuple ("none"))) {}
static url_tree url_tuple(string label)
Definition url.cpp:23

◆ url() [3/5]

url::url ( const char * name)

Definition at line 61 of file url.cpp.

url url_system(string name)
Definition url.cpp:306

◆ url() [4/5]

url::url ( string name)

Definition at line 62 of file url.cpp.

◆ url() [5/5]

url::url ( string dir,
string name )

Definition at line 63 of file url.cpp.

Member Function Documentation

◆ CONCRETE()

url::CONCRETE ( url )
private

◆ operator==()

bool url::operator== ( url u)
inline

Definition at line 48 of file url.hpp.

48{ return rep->t == u->t; }

◆ operator!=()

bool url::operator!= ( url u)
inline

Definition at line 49 of file url.hpp.

49{ return rep->t != u->t; }

◆ operator[]()

url url::operator[] ( int i)
inline

Definition at line 50 of file url.hpp.

50{ return url (rep->t[i]); }
url()
Definition url.cpp:60

◆ label()

string url::label ( )
inline

Definition at line 51 of file url.hpp.

51 {
52 if (is_atomic (rep->t)) return string ("");
53 else return to_string (rep->t[0]);
54 };
string to_string(lolly_tree< T > t)
bool is_atomic(url u)
Definition url.cpp:664

◆ protocol()

string url::protocol ( )

Definition at line 67 of file url.cpp.

67 {
68 string url_label= this->label ();
69 if (url_label == "root") {
70 return rep->t[1]->label;
71 }
72 else if (url_label == "concat") {
73 return as_url (rep->t[1]).protocol ();
74 }
75 else if (url_label == "or") {
76 // For mutiple urls, the protocol must be consistent
77 // otherwise, it is in empty protocol
78 string p1= as_url (rep->t[1]).protocol ();
79 if (p1 == "") return ""; // if empty protocol, return empty protocol fast
80
81 string p2= as_url (rep->t[2]).protocol ();
82 if (p1 == p2) return p1;
83 else return ""; // if the protocol does not match, return empty protocol
84 }
85 else {
86 return "default";
87 }
88}
string label()
Definition url.hpp:51
friend url as_url(url_tree t)
Definition url.hpp:61

Friends And Related Symbol Documentation

◆ as_url

url as_url ( url_tree t)
friend

Definition at line 61 of file url.hpp.

61 {
62 return url (t);
63}

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