/// <summary> /// Retrieves a new configuration from the current configuration /// with the root node being the supplied path. /// </summary> /// <param name="path">The path that contains the configuration to retrieve.</param> /// <returns>A new configuration with the root node being the supplied path.</returns> public virtual Config GetConfig(string path) { return(GetConfig(HoconPath.Parse(path))); }
/// <summary> /// Determine if a HOCON configuration element exists at the specified location /// </summary> /// <param name="path">The location to check for a configuration value.</param> /// <returns><c>true</c> if a value was found, <c>false</c> otherwise.</returns> public bool HasPath(string path) => HasPath(HoconPath.Parse(path));
static HoconPath() { Empty = new HoconPath(); }
/// <summary> /// Retrieves a <see cref="HoconValue"/> from a specific path. /// </summary> /// <param name="path">The path that contains the value to retrieve.</param> /// <returns>The <see cref="HoconValue"/> found at the location if one exists, otherwise <c>null</c>.</returns> public HoconValue GetValue(string path) => GetValue(HoconPath.Parse(path));
public TimeSpan GetMillisDuration(HoconPath path, TimeSpan? @default = null, bool allowInfinite = true) { return(GetTimeSpan(path, @default, allowInfinite)); }
/// <summary> /// Retrieves a list of double values from the specified path in the configuration. /// </summary> /// <param name="path">The path that contains the values to retrieve.</param> /// <returns>The list of double values defined in the specified path.</returns> public IList <double> GetDoubleList(string path) => GetDoubleList(HoconPath.Parse(path));
/// <summary> /// Retrieves a list of byte values from the specified path in the configuration. /// </summary> /// <param name="path">The path that contains the values to retrieve.</param> /// <returns>The list of byte values defined in the specified path.</returns> public IList <byte> GetByteList(string path) => GetByteList(HoconPath.Parse(path));
/// <summary> /// Retrieves a boolean value from the specified path in the configuration. /// </summary> /// <param name="path">The path that contains the value to retrieve.</param> /// <param name="default">The default value to return if the value doesn't exist.</param> /// <returns>The boolean value defined in the specified path.</returns> public bool GetBoolean(string path, bool @default = false) => GetBoolean(HoconPath.Parse(path), @default);
/// <summary> /// Retrieves a long value, optionally suffixed with a 'b', from the specified path in the configuration. /// </summary> /// <param name="path">The path that contains the value to retrieve.</param> /// <returns>The long value defined in the specified path.</returns> public long?GetByteSize(string path) => GetByteSize(HoconPath.Parse(path));
/// <summary> /// Retrieves a string value from the specified path in the configuration. /// </summary> /// <param name="path">The path that contains the value to retrieve.</param> /// <param name="default">The default value to return if the value doesn't exist.</param> /// <returns>The string value defined in the specified path.</returns> public string GetString(string path, string @default = null) => GetString(HoconPath.Parse(path), @default);
/// <inheritdoc cref="GetString(string,string)"/> public string GetString(HoconPath path, string @default = null) { var value = GetNode(path); return(ReferenceEquals(value, HoconValue.Undefined) ? @default : value.GetString()); }
public static HoconPath ToHoconPath(this string path) { return(HoconPath.Parse(path)); }
internal static HoconParserException Create(IHoconLineInfo lineInfo, HoconPath path, string message, Exception ex) { message = FormatMessage(lineInfo, path, message); return(new HoconParserException(lineInfo, message, ex)); }
public HoconField this[HoconPath path] => GetField(path);
/// <summary> /// Retrieves a list of decimal values from the specified path in the configuration. /// </summary> /// <param name="path">The path that contains the values to retrieve.</param> /// <returns>The list of decimal values defined in the specified path.</returns> public IList <decimal> GetDecimalList(string path) => GetDecimalList(HoconPath.Parse(path));
/// <summary> /// Retrieves an integer value from the specified path in the configuration. /// </summary> /// <param name="path">The path that contains the value to retrieve.</param> /// <param name="default">The default value to return if the value doesn't exist.</param> /// <returns>The integer value defined in the specified path.</returns> public int GetInt(string path, int @default = 0) => GetInt(HoconPath.Parse(path), @default);
/// <summary> /// Retrieves a list of float values from the specified path in the configuration. /// </summary> /// <param name="path">The path that contains the values to retrieve.</param> /// <returns>The list of float values defined in the specified path.</returns> public IList <float> GetFloatList(string path) => GetFloatList(HoconPath.Parse(path));
/// <summary> /// Retrieves a long value from the specified path in the configuration. /// </summary> /// <param name="path">The path that contains the value to retrieve.</param> /// <param name="default">The default value to return if the value doesn't exist.</param> /// <returns>The long value defined in the specified path.</returns> public long GetLong(string path, long @default = 0) => GetLong(HoconPath.Parse(path), @default);
/// <summary> /// Retrieves a list of int values from the specified path in the configuration. /// </summary> /// <param name="path">The path that contains the values to retrieve.</param> /// <returns>The list of int values defined in the specified path.</returns> public IList <int> GetIntList(string path) => GetIntList(HoconPath.Parse(path));
public byte GetByte(string path, byte @default = 0) => GetByte(HoconPath.Parse(path), @default);
/// <summary> /// Retrieves a list of string values from the specified path in the configuration. /// </summary> /// <param name="path">The path that contains the values to retrieve.</param> /// <returns>The list of string values defined in the specified path.</returns> public IList <string> GetStringList(string path) => GetStringList(HoconPath.Parse(path));
/// <summary> /// Retrieves a float value from the specified path in the configuration. /// </summary> /// <param name="path">The path that contains the value to retrieve.</param> /// <param name="default">The default value to return if the value doesn't exist.</param> /// <returns>The float value defined in the specified path.</returns> public float GetFloat(string path, float @default = 0) => GetFloat(HoconPath.Parse(path), @default);
/// <inheritdoc cref="GetValue(string)"/> public HoconValue GetValue(HoconPath path) { HoconValue value = GetNode(path); return(value); }
/// <summary> /// Retrieves a decimal value from the specified path in the configuration. /// </summary> /// <param name="path">The path that contains the value to retrieve.</param> /// <param name="default">The default value to return if the value doesn't exist.</param> /// <returns>The decimal value defined in the specified path.</returns> public decimal GetDecimal(string path, decimal @default = 0) => GetDecimal(HoconPath.Parse(path), @default);
/// <summary> /// Retrieves a <see cref="TimeSpan"/> value from the specified path in the configuration. /// </summary> /// <param name="path">The path that contains the value to retrieve.</param> /// <param name="default">The default value to return if the value doesn't exist.</param> /// <param name="allowInfinite"><c>true</c> if infinite timespans are allowed; otherwise <c>false</c>.</param> /// <returns>The <see cref="TimeSpan"/> value defined in the specified path.</returns> public TimeSpan GetTimeSpan(string path, TimeSpan? @default = null, bool allowInfinite = true) => GetTimeSpan(HoconPath.Parse(path), @default, allowInfinite);
/// <summary> /// Retrieves a double value from the specified path in the configuration. /// </summary> /// <param name="path">The path that contains the value to retrieve.</param> /// <param name="default">The default value to return if the value doesn't exist.</param> /// <returns>The double value defined in the specified path.</returns> public double GetDouble(string path, double @default = 0) => GetDouble(HoconPath.Parse(path), @default);
/// <summary> /// Retrieves the backing <see cref="HoconValue"/> value of the <see cref="HoconField"/> associated with /// the supplied <see cref="HoconPath"/> path, relative to this object. /// </summary> /// <param name="path">The relative <see cref="HoconPath"/> path associated with /// the <see cref="HoconField"/> of the <see cref="HoconValue"/> value to retrieve.</param> /// <returns> /// The <see cref="HoconValue"/> value backing the <see cref="HoconField"/> field associated /// with the supplied key. /// </returns> /// <exception cref="ArgumentNullException">path is null</exception> /// <exception cref="ArgumentException">path is empty</exception> /// <exception cref="KeyNotFoundException">The key does not exist in the <see cref="HoconObject"/></exception> public HoconValue GetValue(HoconPath path) { return(GetField(path).Value); }
/// <summary> /// Retrieves a list of boolean values from the specified path in the configuration. /// </summary> /// <param name="path">The path that contains the values to retrieve.</param> /// <returns>The list of boolean values defined in the specified path.</returns> public IList <Boolean> GetBooleanList(string path) => GetBooleanList(HoconPath.Parse(path));
internal static HoconParserException Create(IHoconLineInfo lineInfo, HoconPath path, string message) { return(Create(lineInfo, path, message, null)); }
/// <summary> /// Retrieves a new configuration from the current configuration /// with the root node being the supplied path. /// </summary> /// <param name="path">The path that contains the configuration to retrieve.</param> /// <returns>A new configuration with the root node being the supplied path.</returns> public Config GetConfig(string path) => GetConfig(HoconPath.Parse(path));