xaizek / dit (License: GPLv3) (since 2018-12-07)
Command-line task keeper that remembers all old values and is meant to combine several orthogonal features to be rather flexible in managing items.
<root> / src / Change.hpp (fcb4e37f697d0b3d6d080b79f4e5209776964201) (1,968B) (mode 100644) [raw]
// Copyright (C) 2015 xaizek <xaizek@posteo.net>
//
// This file is part of dit.
//
// dit is free software: you can redistribute it and/or modify
// it under the terms of version 3 of the GNU Affero General Public
// License as published by the Free Software Foundation.
//
// dit 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 dit.  If not, see <http://www.gnu.org/licenses/>.

#ifndef DIT__CHANGE_HPP__
#define DIT__CHANGE_HPP__

#include <ctime>

#include <string>
#include <utility>

/**
 * @brief Represents single change of Item's description.
 */
class Change
{
public:
    /**
     * @brief Constructs a change.
     *
     * @param timestamp When the change took place.
     * @param key What was changed.
     * @param value What's new value.
     */
    Change(std::time_t timestamp, std::string key, std::string value)
        : timestamp(timestamp), key(std::move(key)), value(std::move(value))
    {
    }

public:
    /**
     * @brief Retrieves time at which the change was made.
     *
     * @returns The time.
     */
    std::time_t getTimestamp() const { return timestamp; }
    /**
     * @brief Retrieves name of the field described by this change.
     *
     * @returns The name.
     */
    std::string getKey() const { return key; }
    /**
     * @brief Retrieves value of the field described by this change.
     *
     * @returns The value.
     */
    std::string getValue() const { return value; }

private:
    /**
     * @brief When the change was made.
     */
    std::time_t timestamp;
    /**
     * @brief Name of the field.
     */
    std::string key;
    /**
     * @brief Value of the field.
     */
    std::string value;
};

#endif // DIT__CHANGE_HPP__
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/dit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/dit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master