File indexing completed on 2024-04-14 04:52:45

0001 /*
0002     SPDX-FileCopyrightText: 2020 Elvis Angelaccio <elvis.angelaccio@kde.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef S3URL_H
0007 #define S3URL_H
0008 
0009 #include <QDebug>
0010 #include <QUrl>
0011 
0012 #include <aws/core/utils/memory/stl/AWSString.h>
0013 
0014 class S3Url
0015 {
0016 public:
0017     explicit S3Url(const QUrl &url);
0018 
0019     bool isRoot() const;
0020     bool isBucket() const;
0021     bool isKey() const;
0022     QString bucketName() const;
0023     QString key() const;
0024     QString prefix() const;
0025     QUrl url() const;
0026     // Helpers to convert from QString to Aws::String
0027     // The uppercase naming is a trick to have a sort of overload-by-return-type and is consistent with the AWS sdk style (e.g. SetBucket() and SetKey()).
0028     Aws::String BucketName() const;
0029     Aws::String Key() const;
0030     Aws::String Prefix() const;
0031 
0032 private:
0033     const QUrl m_url;
0034 };
0035 
0036 QDebug operator<<(QDebug debug, const S3Url &s3url);
0037 
0038 #endif // S3URL_H