docs/html/URI_8h_source.html
| | Jetson Inference
DNN Vision Library |
URI.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23 #ifndef __URI_RESOURCE_H_
24 #define __URI_RESOURCE_H_
25
26
27 #include <string>
28
29
102 {
103 public:
107URI();
108
113URI( const char* uri );
114
119bool Parse( const char* uri );
120
124void Print( const char* prefix="" ) const;
125
129inline const char* c_str() const { return string.c_str(); }
130
134operator const char* () const { return string.c_str(); }
135
139operator std::string () const { return string; }
140
144inline void operator =(const char* uri ) { Parse(uri); }
145
149inline void operator =(const std::string& uri ) { Parse(uri.c_str()); }
150
155
160
165
170
175
180 };
181
182 #endif
183
std::string protocol
Protocol string (e.g.
Definition: URI.h:159
const char * c_str() const
Cast to C-style string (const char*)
Definition: URI.h:129
std::string path
Path (for a network URI this comes after the port)
Definition: URI.h:164
std::string string
Full resource URI (what was originally parsed)
Definition: URI.h:154
std::string location
Path, IP address, or device name.
Definition: URI.h:174
void operator=(const char *uri)
Assignment operator (parse URI string)
Definition: URI.h:144
int port
IP port, camera port, ect.
Definition: URI.h:179
URI()
Default constructor.
Resource URI of a video device, IP stream, or file/directory.
Definition: URI.h:101
bool Parse(const char *uri)
Parse the URI from the given resource string.
operator std::string() const
Cast to std::string
Definition: URI.h:139
void Print(const char *prefix="") const
Log the URI, with an optional prefix label.
std::string extension
File extension (for files only, otherwise empty)
Definition: URI.h:169