Address.h 4.06 KB
Newer Older
1
/*
2
Address.h
3 4 5 6 7 8 9 10 11 12 13
Copyright (C) 2015  Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
14
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
15 16 17 18
*/

#pragma once

19
#include "Core.h"
20

21
namespace BelledonneCommunications
22
{
23
	namespace Linphone
24
	{
25
		namespace Native
26 27
		{
			/// <summary>
28 29 30 31 32
			/// Object that represents a SIP address.
			/// It's an opaque object that represents a SIP address, i.e. the content of SIP's "from" and "to" headers.
			/// A SIP address is made of a display name, username, domain, port and various URI headers(such as tags).
			/// It looks like "Alice &lt;sip:alice@example.net&gt;". The LinphoneAddress has methods to extract and manipulate all parts of the address.
			/// When some part of the address (for example the username) is empty, the accessor method return null.
33
			/// </summary>
34 35 36 37 38 39 40 41 42 43 44
			/// <example>
			/// Can be instancied using:
			/// <code>
			/// Address addr = Core.CreateAddress("sip:alice@example.net");
			/// </code>
			/// or
			/// <code>
			/// Address addr = Core.CreateAddress("alice", "example.net", "Alice B.");
			/// </code>
			/// </example>
			public ref class Address sealed
45
			{
46 47 48 49 50 51 52 53 54 55
			public:
				/// <summary>
				/// The human display name of the address.
				/// For example for the "Alice &lt;sip:alice@example.net&gt;" URI, it will return "Alice".
				/// </summary>
				property Platform::String^ DisplayName
				{
					Platform::String^ get();
					void set(Platform::String^ value);
				}
56

57 58 59 60 61 62 63 64 65
				/// <summary>
				/// The domain part of the address.
				/// For example for the "Alice &lt;sip:alice@example.net&gt;" URI, it will return "example.net".
				/// </summary>
				property Platform::String^ Domain
				{
					Platform::String^ get();
					void set(Platform::String^ value);
				}
66

67 68 69 70 71 72 73 74
				/// <summary>
				/// The port part of the address.
				/// </summary>
				property int Port
				{
					int get();
					void set(int value);
				}
75

76 77 78 79 80 81 82
				/// <summary>
				/// The address scheme, normally "sip".
				/// </summary>
				property Platform::String^ Scheme
				{
					Platform::String^ get();
				}
83

84 85 86 87 88 89 90 91
				/// <summary>
				/// The transport of the address.
				/// </summary>
				property Transport Transport
				{
					BelledonneCommunications::Linphone::Native::Transport get();
					void set(BelledonneCommunications::Linphone::Native::Transport value);
				}
92

93 94 95 96 97 98 99 100 101
				/// <summary>
				/// The username part of the address.
				/// For example for the "Alice &lt;sip:alice@example.net&gt;" URI, it will return "alice".
				/// </summary>
				property Platform::String^ UserName
				{
					Platform::String^ get();
					void set(Platform::String^ value);
				}
102

103 104 105 106 107
				/// <summary>
				/// Gets the string representation of the address.
				/// </summary>
				/// <returns>The address as a string</returns>
				Platform::String^ AsString();
108

109 110 111 112 113
				/// <summary>
				/// Gets the string representation of the URI part of the address (without the display name).
				/// </summary>
				/// <returns>The address without display name as a string</returns>
				Platform::String^ AsStringUriOnly();
114

115 116 117 118
				/// <summary>
				/// Removes address's tags and uri headers so that it is displayable to the user.
				/// </summary>
				void Clean();
119

120 121 122 123 124 125 126 127 128
				/// <summary>
				/// Same as AsString.
				/// </summary>
				/// <seealso cref="AsString()" />
				virtual Platform::String^ ToString() override;

			private:
				friend class Utils;
				friend ref class Core;
129

130 131 132
				Address(::LinphoneAddress *addr);
				Address(const char *uri);
				~Address();
133

134 135 136
				::LinphoneAddress *address;
			};
		}
137
	}
138
}