]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- use std::any instead of boost::any
authorArvin Schnell <aschnell@suse.de>
Tue, 27 Jan 2026 14:40:17 +0000 (15:40 +0100)
committerArvin Schnell <aschnell@suse.de>
Tue, 27 Jan 2026 14:40:17 +0000 (15:40 +0100)
client/snapper/cmd-list.cc
client/snbk/cmd-list-configs.cc
client/snbk/cmd-list.cc
client/utils/OutputOptions.cc
client/utils/OutputOptions.h

index b00f4a302953a4d1c99d21e20d2ae19acd8cf2f0..8b00db062b6283e5e70faa78db8672ca49f9a1aa 100644 (file)
@@ -24,7 +24,7 @@
 #include "config.h"
 
 #include <iostream>
-#include <boost/any.hpp>
+#include <any>
 
 #include <snapper/SnapperTmpl.h>
 #include <snapper/BtrfsUtils.h>
@@ -381,7 +381,7 @@ namespace snapper
        }
 
 
-       boost::any
+       std::any
        value_for_as_any(const OutputOptions& output_options, const OutputHelper& output_helper, Column column,
                         const ProxySnapshot& snapshot)
        {
@@ -480,7 +480,7 @@ namespace snapper
        value_for_as_string(const OutputOptions& output_options, const OutputHelper& output_helper,
                            Column column, const ProxySnapshot& snapshot)
        {
-           boost::any value = value_for_as_any(output_options, output_helper, column, snapshot);
+           std::any value = value_for_as_any(output_options, output_helper, column, snapshot);
 
            if (value.type() == typeid(nullptr_t))
            {
@@ -488,26 +488,26 @@ namespace snapper
            }
            else if (value.type() == typeid(unsigned int))
            {
-               return decString(boost::any_cast<unsigned int>(value));
+               return decString(std::any_cast<unsigned int>(value));
            }
            else if (value.type() == typeid(bool))
            {
                if (output_options.human)
-                   return boost::any_cast<bool>(value) ? _("yes") : _("no");
+                   return std::any_cast<bool>(value) ? _("yes") : _("no");
                else
-                   return boost::any_cast<bool>(value) ? "yes" : "no";
+                   return std::any_cast<bool>(value) ? "yes" : "no";
            }
            else if (value.type() == typeid(string))
            {
-               return boost::any_cast<string>(value).c_str();
+               return std::any_cast<string>(value).c_str();
            }
            else if (value.type() == typeid(uint64_t))
            {
-               return decString(boost::any_cast<uint64_t>(value));
+               return decString(std::any_cast<uint64_t>(value));
            }
            else if (value.type() == typeid(map<string, string>))
            {
-               return show_userdata(boost::any_cast<map<string, string>>(value));
+               return show_userdata(std::any_cast<map<string, string>>(value));
            }
 
            SN_THROW(Exception("invalid column type in value_for_as_string"));
@@ -519,7 +519,7 @@ namespace snapper
        value_for_as_json(const OutputOptions& output_options, const OutputHelper& output_helper,
                          Column column, const ProxySnapshot& snapshot)
        {
-           boost::any value = value_for_as_any(output_options, output_helper, column, snapshot);
+           std::any value = value_for_as_any(output_options, output_helper, column, snapshot);
 
            if (value.type() == typeid(nullptr_t))
            {
@@ -527,27 +527,27 @@ namespace snapper
            }
            else if (value.type() == typeid(unsigned int))
            {
-               return json_object_new_int(boost::any_cast<unsigned int>(value));
+               return json_object_new_int(std::any_cast<unsigned int>(value));
            }
            else if (value.type() == typeid(bool))
            {
-               return json_object_new_boolean(boost::any_cast<bool>(value));
+               return json_object_new_boolean(std::any_cast<bool>(value));
            }
            else if (value.type() == typeid(string))
            {
-               return json_object_new_string(boost::any_cast<string>(value).c_str());
+               return json_object_new_string(std::any_cast<string>(value).c_str());
            }
            else if (value.type() == typeid(uint64_t))
            {
 #if JSON_C_VERSION_NUM >= ((0 << 16) | (14 << 8) | 0)
-               return json_object_new_uint64(boost::any_cast<uint64_t>(value));
+               return json_object_new_uint64(std::any_cast<uint64_t>(value));
 #else
-               return json_object_new_int64(boost::any_cast<uint64_t>(value));
+               return json_object_new_int64(std::any_cast<uint64_t>(value));
 #endif
            }
            else if (value.type() == typeid(map<string, string>))
            {
-               map<string, string> tmp = boost::any_cast<map<string, string>>(value);
+               map<string, string> tmp = std::any_cast<map<string, string>>(value);
                if (tmp.empty())
                    return nullptr;
 
index bdd6da55f172c71cc6ea86d6e8b89104d9452356..11e7958e3d1fc46abf48961022f4dee79d499c51 100644 (file)
@@ -115,7 +115,7 @@ namespace snapper
        }
 
 
-       boost::any
+       std::any
        value_for_as_any(Column column, const BackupConfig& backup_config)
        {
            switch (column)
index 2923627e53f1106a538df3213f7b101b210b51f1..c0ed98f9c606e22961ac1159d158ddfe14b34d12 100644 (file)
@@ -120,7 +120,7 @@ namespace snapper
        }
 
 
-       boost::any
+       std::any
        value_for_as_any(const OutputOptions& output_options, Column column, const BackupConfig& backup_config,
                         const TheBigThing& the_big_thing)
        {
index aa950fa8e6bf6eb638da5bc03dbf029cb916d445..adb37a8cb28f3ad2016e873206efb14561715e26 100644 (file)
@@ -35,7 +35,7 @@ namespace snapper
 
 
     string
-    any_to_string(const OutputOptions& output_options, const boost::any& value)
+    any_to_string(const OutputOptions& output_options, const std::any& value)
     {
        if (value.type() == typeid(nullptr_t))
        {
@@ -45,19 +45,19 @@ namespace snapper
        if (value.type() == typeid(bool))
        {
            if (output_options.human)
-               return boost::any_cast<bool>(value) ? _("yes") : _("no");
+               return std::any_cast<bool>(value) ? _("yes") : _("no");
            else
-               return boost::any_cast<bool>(value) ? "yes" : "no";
+               return std::any_cast<bool>(value) ? "yes" : "no";
        }
 
        if (value.type() == typeid(unsigned int))
        {
-           return to_string(boost::any_cast<unsigned int>(value));
+           return to_string(std::any_cast<unsigned int>(value));
        }
 
        if (value.type() == typeid(string))
        {
-           return boost::any_cast<string>(value).c_str();
+           return std::any_cast<string>(value).c_str();
        }
 
        SN_THROW(Exception("invalid type in any_to_string"));
@@ -66,7 +66,7 @@ namespace snapper
 
 
     json_object*
-    any_to_json(const OutputOptions& output_options, const boost::any& value)
+    any_to_json(const OutputOptions& output_options, const std::any& value)
     {
        if (value.type() == typeid(nullptr_t))
        {
@@ -75,17 +75,17 @@ namespace snapper
 
        if (value.type() == typeid(bool))
        {
-           return json_object_new_boolean(boost::any_cast<bool>(value));
+           return json_object_new_boolean(std::any_cast<bool>(value));
        }
 
        if (value.type() == typeid(unsigned int))
        {
-           return json_object_new_int(boost::any_cast<unsigned int>(value));
+           return json_object_new_int(std::any_cast<unsigned int>(value));
        }
 
        if (value.type() == typeid(string))
        {
-           return json_object_new_string(boost::any_cast<string>(value).c_str());
+           return json_object_new_string(std::any_cast<string>(value).c_str());
        }
 
        SN_THROW(Exception("invalid type in any_to_json"));
index 3df41ba37fae1301eda151b77ad93aa404e7dfd2..b48e8f0711197b81756eff79c4a43b236d4d177a 100644 (file)
@@ -22,7 +22,7 @@
 
 
 #include <string>
-#include <boost/any.hpp>
+#include <any>
 #include <json-c/json.h>
 
 
@@ -54,10 +54,10 @@ namespace snapper
     // TODO extend functions and use in client/snapper
 
     string
-    any_to_string(const OutputOptions& output_options, const boost::any& value);
+    any_to_string(const OutputOptions& output_options, const std::any& value);
 
 
     json_object*
-    any_to_json(const OutputOptions& output_options, const boost::any& value);
+    any_to_json(const OutputOptions& output_options, const std::any& value);
 
 }