> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ansys::Project::URL Class Reference

The address of a local or remote file, using the URI format.

`#include "URL.hpp"`

## Public Member Functions

| Type | Name |
| - | - |
| | [URL](#a8890e4a55032db962f7534d89d6c8d25) () Default constructor. |
| | [URL](#a6da60a7ea6909813c3ef709f40c3e105) (const std::string \&pStr) Constructor from string. |
| | [URL](#a940c44d6fe20e9c90c51d27ac1af208a) (const std::string \&pType, const std::string \&pStr) Constructor from type and path/filename. |
| | [URL](#a458227b58a30cc5465e458d7510c9763) (const char \*pStr) Constructor from char\*. |
| | [\~URL](#a951183196b45dcc2897a74b232021d2f) () Destructor. |
| std::string | [getFilename](#a7fa872a791c333b1460f4f818151dee9) () const Returns the file component of the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md), path removed. |
| std::string | [getItemName](#ac7c76f112c4f37854c30675fb4f4b40e) () const Returns the last name (directory or file) from the path. |
| std::string | [getFilenameRoot](#ac1ced383f9b4e25d43c8b927a93423cf) () const Returns root (suffix removed) from the filename. |
| std::string | [getFilenamePath](#a95a5b43b27aace93fd61e4e3a4aea6d0) () const Returns the path from a filename. |
| std::string | [getURLString](#ad17fc0b52d20b464999e20ded43710bb) () const Returns the full type://path/filename for a [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md). |
| std::vector\< std::string > | [getURLComponents](#ad9f5887fdfe9708cfe9ba5a21548a95d) () const |
| [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) | [getURLSubset](#a67cbbd45a04c1dba8cc56b449b3c474f) (int pComponentStart, int pEnd=-1) const Return a subset of the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) components. |
| bool | [isValid](#a5e708d0c6bdc68ec2f58a55e4746a64a) () const Indicate if [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) is defined. |
| bool | [isNull](#a841f43183ed1745e48c68573be7d783a) () const Indicate if [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) path/filename is non null. |
| bool | [isLocalPath](#a6100f020e2802b541799ef6abe27bba0) () const Indicate if [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) path/filename is a ./ path. |
| bool | [isRelativePath](#a1e5423f5e62d85c414746e42fb27ee99) () const Indicate if [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) path/filename is a relative path. |
| bool | [isGlobalPath](#abd0cafeb009a49398e0e66f000af0748) () const Indicate if [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) path/filename is a global path. |
| bool | [isInside](#aaa5cc3f1f5280cb9a6e0eeca0663422e) (const [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) \&pURL) const Indicate if [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) is inside the specified folder [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md). |
| [URLType](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/namespaceansys_1_1_project#ace059df4e22fa40f903b085e314a934c) | [getType](#afca6d0bfdbd341416abe058a22dd7928) () const Return the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) type. |
| const std::string & | [str](#adfa904dbbd5f478035b455c19361a0f9) () const Returns the path/file component of the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md). |
| const char \* | [c\_str](#abbadb1bf536a72c3bd8c74ab1c939794) () const |
| void | [toGlobal](#a07b8c80c3a34a8973d7210d40a94cc01) (const [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) \&pRootPath) Convert [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) to global path. |
| void | [toRelative](#ad95c60ea798859bd647d53f5a17293c4) (const [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) \&pRefDir) Convert [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) to relative path. |
| void | [simplifyURL](#a3d2acb9a63d3725b6e56a981efca159d) () Simplify [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) by removing internal relative paths. |
| bool | [operator!=](#af288000689d17f17b7b5752b6e73118d) (const [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) \&pURL) const Unequal operator. |
| bool | [operator==](#a35c9cec29e715559279ef1b37279959c) (const [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) \&pURL) const Equal operator. |
| bool | [operator==](#aa2ad6e8d9113f5814924266d6283e5b6) (const std::string \&pURLString) const Equal operator - with string. |
| [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) | [operator+](#a74cd47ea4d24a1729181e03881da16b7) (const [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) \&p2) const Concatenation operator. |
| [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) & | [operator+=](#ae56a17a4cb49d9560aa9a9bb7be6edac) (const [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) \&p2) Self concatenation operator. |
| bool | [normalizeToFolder](#a33e9abf89d03cf73aa2bfab839d347e5) () Ensure the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) is a folder path, if trailing / was missing. |

## Detailed Description

The address of a local or remote file, using the URI format.

The [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) objects contains the string for a [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) path and provides string operations on it. A [Project](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_project) define an [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) for each file or folder, the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) will indicate where to fetch the content.

A [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) is a data location as

```cpp theme={null}
type://path
file:///home/user/file
http://host.com/folder/file
```

A special type of [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) is also supported: relative paths

```cpp theme={null}
./filename
```

Relative paths infer their global location from their parent directory (PFolder)

#### Type

The type can be omitted, it is then assumed a "file://" type see [URL::getType()](#afca6d0bfdbd341416abe058a22dd7928)

"filename" -> "file://filename"

The type is tied to a [Storage](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_storage.md) interface, and some project operations ( file access, deletion, etc.) will require the matching [Storage](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_storage.md) plug-in to access the remote file. \


*Note: (2020R2) only a "file://" interface is provided via [StorageFilesystem](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_storage_filesystem.md)*

#### Differences with URI specs:

* a [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) object can be initialized with a relative path ( starts with ./) but such an [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) is only used for [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) composision
* The single slash [file:/path](file:/path) syntax is not supported, only [file://..](file://..).

#### Path/Filename component

[str()](#adfa904dbbd5f478035b455c19361a0f9), [c\_str()](#abbadb1bf536a72c3bd8c74ab1c939794) will return the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) content without the type "file:///path/filename" -> "/path/filename"

#### Type: file

The file paths are stored with the / separator (if \ windows separator are used, the are converted to /, except file sharing paths)

```cpp theme={null}
"/path/to/file" -> "/path/to/file"
"./relative/file" -> "./relative/file"
"d:\path\to\file" -> "d:/path/to/file"
"\\filesystem\path\file" -> "\\filesystem\path\file"
```

## Constructor & Destructor Documentation

### URL() \[1/4]

```cpp theme={null}
ansys::Project::URL::URL()
```

Default constructor.

### URL() \[2/4]

```cpp theme={null}
ansys::Project::URL::URL(const std::string & pURL)
```

Constructor from string.

Builds [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) from string. If type:// is omitted, the type "file" is assumed.

**Parameters**

| Name | Description |
| - | - |
| pURL | String with a valid full URI |

### URL() \[3/4]

```cpp theme={null}
ansys::Project::URL::URL(
    const std::string & pType,
    const std::string & pURL
)
```

Constructor from type and path/filename.

Builds [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) from type and filename. Type is such as "file"

**Parameters**

| Name | Description |
| - | - |
| pType | Name Type of the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) - ex: "file" |
| pURL | Filename with path of the file or folder. |

### URL() \[4/4]

```cpp theme={null}
ansys::Project::URL::URL(const char * pStr)
```

Constructor from char\*.

Builds [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) from string. If type:// is omitted, the type "file" is assumed.

**Parameters**

| Name | Description |
| - | - |
| pStr | String with a valid full URI |

### \~URL()

```cpp theme={null}
ansys::Project::URL::~URL()
```

Destructor.

## Member Function Documentation

### c\_str()

```cpp theme={null}
const char * ansys::Project::URL::c_str() const
```

`inline`

### getFilename()

```cpp theme={null}
std::string ansys::Project::URL::getFilename() const
```

Returns the file component of the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md), path removed.

The path is removed and only the filename is returned /path/to/filename -> filename /path/to/ -> (empty string)

**Returns**

path/file component of the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md)

### getFilenamePath()

```cpp theme={null}
std::string ansys::Project::URL::getFilenamePath() const
```

Returns the path from a filename.

Return the path of a file /path/to/file.cas -> /path/to/ /path/folder/ -> /path/folder/

**Returns**

item name as string

### getFilenameRoot()

```cpp theme={null}
std::string ansys::Project::URL::getFilenameRoot() const
```

Returns root (suffix removed) from the filename.

This function can only be used on file URLs: /path/to/file.cas -> file /path/to/file\_cas -> file\_cas /path/folder/ -> (empty string)

**Returns**

item name as string

### getItemName()

```cpp theme={null}
std::string ansys::Project::URL::getItemName() const
```

Returns the last name (directory or file) from the path.

Only the last component of the path is returned, including / for folder name. /path/to/filename -> filename /path/folder/ -> folder/

**Returns**

item name as string

### getType()

```cpp theme={null}
URLType ansys::Project::URL::getType() const
```

Return the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) type.

**Returns**

type string

### getURLComponents()

```cpp theme={null}
std::vector< std::string > ansys::Project::URL::getURLComponents() const
```

### getURLString()

```cpp theme={null}
std::string ansys::Project::URL::getURLString() const
```

Returns the full type://path/filename for a [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md).

The type is always included, even if using implicit [file://](file://) ./file -> [file://./file](file://./file) /path/file -> [file:///path/file](file:///path/file)

**Returns**

Full [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) as string

### getURLSubset()

```cpp theme={null}
URL ansys::Project::URL::getURLSubset(
    int pComponentStart,
    int pEnd = -1
) const
```

Return a subset of the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) components.

The [getURLComponents()](#ad9f5887fdfe9708cfe9ba5a21548a95d) returns an array of the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) items /path/file -> \[ / , path/ , file] This function returns the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) forming the subset between indices in this array

**Parameters**

| Name | Description |
| - | - |
| pComponentStart | start of the subset (starts at 0) |
| pEnd | end of the subset, not included. (omit, or -1 to include up to the end of the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md)) |

**Returns**

[URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) of the subset, if a folder will end by /

### isGlobalPath()

```cpp theme={null}
bool ansys::Project::URL::isGlobalPath() const
```

Indicate if [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) path/filename is a global path.

A global path starts by / , \ (windows file share) or is a windows drive name (i.e. c:/ ...)

**Returns**

true if global

### isInside()

```cpp theme={null}
bool ansys::Project::URL::isInside(const URL & pURL) const
```

Indicate if [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) is inside the specified folder [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md).

Note that the paths must be exactly the same, symbolic links, aliases or platform-specific case insensivity are not supported

**Returns**

true if within the specified path

### isLocalPath()

```cpp theme={null}
bool ansys::Project::URL::isLocalPath() const
```

Indicate if [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) path/filename is a ./ path.

A local path starts by ./ and assumes inside local directory

**Returns**

true if relative

### isNull()

```cpp theme={null}
bool ansys::Project::URL::isNull() const
```

Indicate if [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) path/filename is non null.

**Returns**

true if non null

### isRelativePath()

```cpp theme={null}
bool ansys::Project::URL::isRelativePath() const
```

Indicate if [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) path/filename is a relative path.

A relative path starts by ./ or ../

**Returns**

true if relative

### isValid()

```cpp theme={null}
bool ansys::Project::URL::isValid() const
```

Indicate if [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) is defined.

Checks if the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) is non null and atype is defined

**Returns**

true if valid

### normalizeToFolder()

```cpp theme={null}
bool ansys::Project::URL::normalizeToFolder()
```

Ensure the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) is a folder path, if trailing / was missing.

**Returns**

false if error

### operator!=()

```cpp theme={null}
bool ansys::Project::URL::operator!=(const URL & pURL) const
```

Unequal operator.

**Returns**

true if [URL::operator==()](#a35c9cec29e715559279ef1b37279959c) is false

### operator+()

```cpp theme={null}
URL ansys::Project::URL::operator+(const URL & p2) const
```

Concatenation operator.

Adds the path/filename to the value of current [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) and returns the new [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md).

**Returns**

[URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) with concatenated value

### operator+=()

```cpp theme={null}
URL & ansys::Project::URL::operator+=(const URL & p2)
```

Self concatenation operator.

Adds the path/filename to the current [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) modifying the current object.

**Returns**

[URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) with concatenated value

### operator==() \[1/2]

```cpp theme={null}
bool ansys::Project::URL::operator==(const std::string & pURLString) const
```

Equal operator - with string.

**Returns**

true if both type and [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) string are the same

### operator==() \[2/2]

```cpp theme={null}
bool ansys::Project::URL::operator==(const URL & pURL) const
```

Equal operator.

**Returns**

true if both type and [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) string are the same

### simplifyURL()

```cpp theme={null}
void ansys::Project::URL::simplifyURL()
```

Simplify [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) by removing internal relative paths.

Remove relative paths included in the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md), such as /path/to/../file will become /path/file

**Parameters**

| Name | Description |
| - | - |
| pRefPath | Folder [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) |

### str()

```cpp theme={null}
const std::string & ansys::Project::URL::str() const
```

Returns the path/file component of the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md).

**Returns**

path/file component of the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md)

### toGlobal()

```cpp theme={null}
void ansys::Project::URL::toGlobal(const URL & pRootPath)
```

Convert [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) to global path.

Appends the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) to the supplied directory Can only be used on a relative [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) ( start with ./ or ../ )

**Parameters**

| Name | Description |
| - | - |
| pRootPath | Folder [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) |

### toRelative()

```cpp theme={null}
void ansys::Project::URL::toRelative(const URL & pRefPath)
```

Convert [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) to relative path.

Convert the [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) to relative from the specified location Can only be used on a global path with a common root

**Parameters**

| Name | Description |
| - | - |
| pRefPath | Folder [URL](https://developer.synopsys.com/docs/cff/common-fluids-format-sdk-guide/classansys_1_1_project_1_1_u_r_l.md) |
