]>
git.saurik.com Git - apple/javascriptcore.git/blob - wtf/url/src/URLSegments.h
436c7fe4f8edc08e56305f5b8418374620e3f1e0
1 // Copyright 2007, Google Inc. All rights reserved.
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
13 // * Neither the name of Google Inc. nor the names of its
14 // contributors may be used to endorse or promote products derived from
15 // this software without specific prior written permission.
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #include "URLComponent.h"
36 // A structure that holds the identified parts of an input URL. This structure
37 // does NOT store the URL itself. The caller will have to store the URL text
38 // and its corresponding Parsed structure separately.
41 // Identifies different components.
55 // Returns the length of the URL (the end of the last component).
57 // Note that for some invalid, non-canonical URLs, this may not be the length
58 // of the string. For example "http://": the parsed structure will only
59 // contain an entry for the four-character scheme, and it doesn't know about
60 // the "://". For all other last-components, it will return the real length.
63 // Returns the number of characters before the given component if it exists,
64 // or where the component would be if it did exist. This will return the
65 // string length if the component would be appended to the end.
67 // Note that this can get a little funny for the port, query, and fragment
68 // components which have a delimiter that is not counted as part of the
69 // component. The |includeDelimiter| flag controls if you want this counted
70 // as part of the component or not when the component exists.
72 // This example shows the difference between the two flags for two of these
73 // delimited components that is present (the port and query) and one that
74 // isn't (the reference). The components that this flag affects are marked
77 // 012345678901234567890
78 // Example input: http://foo:80/?query
79 // include_delim=true, ...=false ("<-" indicates different)
89 int charactersBefore(ComponentType
, bool includeDelimiter
) const;
91 // Each component excludes the related delimiters and has a length of -1
92 // if that component is absent but 0 if the component exists but is empty.
94 URLComponent username
;
95 URLComponent password
;
100 URLComponent fragment
;
105 #endif // URLSegments_h