LCOV - code coverage report
Current view: top level - core - awsregion.h (source / functions) Hit Total Coverage
Test: libqtaws 0.1.0 Lines: 1 1 100.0 %
Date: 2015-06-16 07:50:35 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /*
       2             :     Copyright 2013-2015 Paul Colby
       3             : 
       4             :     This file is part of libqtaws.
       5             : 
       6             :     Libqtaws is free software: you can redistribute it and/or modify
       7             :     it under the terms of the GNU Lesser General Public License as published by
       8             :     the Free Software Foundation, either version 3 of the License, or
       9             :     (at your option) any later version.
      10             : 
      11             :     Libqtaws is distributed in the hope that it will be useful,
      12             :     but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             :     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14             :     GNU Lesser General Public License for more details.
      15             : 
      16             :     You should have received a copy of the GNU Lesser General Public License
      17             :     along with libqtaws.  If not, see <http://www.gnu.org/licenses/>.
      18             : */
      19             : 
      20             : #ifndef AWSREGION_H
      21             : #define AWSREGION_H
      22             : 
      23             : #include "qtawsglobal.h"
      24             : #include "awsendpoint.h"
      25             : 
      26             : #include <QFlags>
      27             : #include <QStringList>
      28             : 
      29             : QTAWS_BEGIN_NAMESPACE
      30             : 
      31             : class AwsRegionPrivate;
      32             : 
      33             : class QTAWS_EXPORT AwsRegion {
      34             : 
      35             : public:
      36             :     /// Bit flags representing the possible cardinal directions of
      37             :     /// AWS regions within macro-regions.
      38             :     enum CardinalDirection {
      39             :         North          = 0x00,
      40             :         NorthNorthEast = 0x10,
      41             :         NorthEast      = 0x20,
      42             :         EastNorthEast  = 0x30,
      43             :         East           = 0x40,
      44             :         EastSouthEast  = 0x50,
      45             :         SouthEast      = 0x60,
      46             :         SouthSouthEast = 0x70,
      47             :         South          = 0x80,
      48             :         SouthSouthWest = 0x90,
      49             :         SouthWest      = 0xA0,
      50             :         WestSouthWest  = 0xB0,
      51             :         West           = 0xC0,
      52             :         WestNorthWest  = 0xD0,
      53             :         NorthWest      = 0xE0,
      54             :         NortNorthWest  = 0xF0
      55             :     };
      56             : 
      57             :     /// AWS macro-regions.
      58             :     enum MacroRegion {
      59             :         AsiaPacific     = 0x100,
      60             :         Europe          = 0x300,
      61             :         SouthAmerica    = 0xA00,
      62             :         UnitedStates    = 0xB00,
      63             :         UnitedStatesGov = 0xC00
      64             :     };
      65             : 
      66             :     /// AWS regions.
      67             :     enum Region {
      68             :         InvalidRegion  = 0,
      69             :         AP_Northeast_1 = AsiaPacific     + NorthEast + 0x1,
      70             :         AP_Southeast_1 = AsiaPacific     + SouthEast + 0x1,
      71             :         AP_Southeast_2 = AsiaPacific     + SouthEast + 0x2,
      72             :         EU_West_1      = Europe          + West      + 0x1,
      73             :         SA_East_1      = SouthAmerica    + East      + 0x1,
      74             :         US_East_1      = UnitedStates    + East      + 0x1,
      75             :         US_Gov_West_1  = UnitedStatesGov + West      + 0x1,
      76             :         US_West_1      = UnitedStates    + West      + 0x1,
      77             :         US_West_2      = UnitedStates    + West      + 0x2
      78             :     };
      79             :     Q_DECLARE_FLAGS(Regions, Region)
      80             : 
      81             :     AwsRegion(const Region region);
      82             :     AwsRegion(const QString &regionName);
      83             :     ~AwsRegion();
      84             : 
      85             :     bool isValid() const;
      86             :     Region region() const;
      87             : 
      88             :     QString name() const;
      89             :     static QString name(const Region &region);
      90             : 
      91             :     QString fullName() const;
      92             :     static QString fullName(const Region &region);
      93             : 
      94             :     QString hostName(const QString &serviceName) const;
      95             : 
      96             :     bool isSupported(const QString &serviceName,
      97             :                      const AwsEndpoint::Transports transports = AwsEndpoint::AnyTransport) const;
      98             : 
      99             :     QStringList supportedServices(const AwsEndpoint::Transports transports = AwsEndpoint::AnyTransport) const;
     100             : 
     101             :     static Region fromName(const QString &regionName);
     102             : 
     103             : private:
     104        3884 :     Q_DECLARE_PRIVATE(AwsRegion)
     105             :     AwsRegionPrivate * const d_ptr; ///< Internal d-pointer.
     106             :     friend class TestAwsRegion;
     107             : };
     108             : 
     109             : Q_DECLARE_OPERATORS_FOR_FLAGS(AwsRegion::Regions)
     110             : 
     111             : QTAWS_END_NAMESPACE
     112             : 
     113             : #endif

Generated by: LCOV version 1.11