Skip to content

Latest commit

 

History

History
80 lines (61 loc) · 1.73 KB

File metadata and controls

80 lines (61 loc) · 1.73 KB

Common

THash - Simple hash function

Introduction

This class implement a generic hash function, used for mapping string onto a dedicated type.

Usecases

  • User wants to compare two string much faster, just calculate their hashes and do a comparison for them.

Examples

#include <cppcore/Common/Hash.h>
#include <iostream>

using UiHash = CPPCore::THash<unsigned int>;

void main() {
    // Simple, just 10
    UiHash myHash2(10U);
    std::cout << "Value " << myHash2.hashValue() << std::endl;

    // Will calculate the hash for string test 
    UiHash myHash3("test", 7);
    std::cout << "Hash for string test is "<< myHash3.hashValue() << endl;
}

TBitField

Introduction

A little class to help working with bitsets.

Usecases

You need to manage singe bits and you want to avoid dealing with the OR-, AND- and XOR-operations provided by c.

Examples

#include <cppcore/Common/Hash.h>
#include <iostream>

void main() {
    TBitField<uint32_t> bitfield(0);

    // The first bit is set
    bitfield.setBit(1);
    if (bitfield.getBit(1)) std::cout "First bit is set" << std:endl;

    bitfield.clearBit(1);
    if (!bitfield.getBit(1)) std::cout "First bit is not set" << std:endl;
}

TOptional

Introduction

Usecases

Examples

TSpan

Introduction

Usecases

Examples

TStringBase

Introduction

Usecases

Examples

TStringView

Introduction

You have to deal with string readouts without having write access to them.

Usecases

Examples

Variant

Introduction

A class to store pod-types in a much easier way if you need more dynamic in the data handling.

Usecases

You need to get data coming from a configuration, which types a dynamic.

Examples