repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
kriskate/motor-on-roller-blind-ws | src/OTASetup.h | #include <ArduinoOTA.h>
void otaSetup(char *config_name)
{
// Authentication to avoid unauthorized updates
//ArduinoOTA.setPassword(<PASSWORD>);
ArduinoOTA.setHostname(config_name);
ArduinoOTA.onStart([]() {
Serial.println(F("Start"));
});
ArduinoOTA.onEnd([]() {
Serial.println(F("\nEnd"));
});... |
kriskate/motor-on-roller-blind-ws | src/WiFiManagerSetup.h |
#include <WiFi.h>
#include <WiFiManager.h>
#include <WiFiUdp.h>
//Configure Default Settings for Access Point logon
String APid = "Blinds AP"; //Name of access point
String APpw = ""; //Hardcoded password for access point
char config_name[40] = "blinds"; //WIFI config: Bonjour name of device
char config_... |
kriskate/motor-on-roller-blind-ws | src/MQTTSetup.h | <reponame>kriskate/motor-on-roller-blind-ws<gh_stars>0
#include <ArduinoJson.h>
#include <WiFiClient.h>
#include <PubSubClient.h>
WiFiClient espClient;
PubSubClient psclient(espClient); //MQTT client
boolean mqttActive = true;
char mqtt_server[40]; //WIFI config: MQTT server config (optional)
char mqtt_port[6... |
kriskate/motor-on-roller-blind-ws | src/WebServerSetup.h | <reponame>kriskate/motor-on-roller-blind-ws
#include <WebServer.h>
#include "index_html.h"
#include <ESPmDNS.h>
#include <WiFi.h>
// Version number for checking if there are new code releases and notifying the user
String version = "1.3.3";
WebServer server(80); // TCP server at port 80 will respond to HTTP requests... |
kriskate/motor-on-roller-blind-ws | src/WebSocketsSetup.h | #include <WebSocketsServer.h>
WebSocketsServer webSocket = WebSocketsServer(81); // WebSockets will respond on port 81
void webSocketsSetup(void (*processMsg)(String res, uint8_t clientnum))
{
//Start websocket
webSocket.begin();
webSocket.onEvent([&](uint8_t num, WStype_t type, uint8_t *payload, size_t length... |
mdr78/dpdk-simple-app | simple.c | <reponame>mdr78/dpdk-simple-app<gh_stars>0
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <stdbool.h>
#include <rte_eal.h>
#include <rte_common.h>
#include <rte_ethdev.h>
#include <rte_ether.h>
#include <rte_log.h>
#include <rte_mbuf.h>
#include <rte_version.h>
static volatile bool force_quit;
/... |
NullSeile/UITools | src/Widget.h | #pragma once
#include "Button.h"
#include "Slider.h"
#include "Sprite.h"
#include "Text.h"
#include "Line.h"
#include "Rectangle.h"
#include "Circle.h"
#include "Graph.h"
#include "InteractiveGraph.h"
#include "ToggleButton.h"
#include "Event.h"
namespace ui
{
class Widget
{
private:
std::vector<ui::UIObject*> m... |
NullSeile/UITools | src/Graph.h | #pragma once
#include "UIObject.h"
#include "Interactuable.h"
namespace ui {
struct ArrowDef
{
float width = 5;
sf::Color color = sf::Color::Black;
};
struct PlotDef
{
float width = 2;
sf::Color color = sf::Color::Black;
bool cyclic = false;
bool optimize = true;
};
struct ScatterDef
{
float ... |
NullSeile/UITools | src/Global.h | <filename>src/Global.h
#pragma once
#define _USE_MATH_DEFINES
#include <SFML\Graphics.hpp>
#include <iostream>
#include <vector>
#include <fstream>
#include <iomanip>
#include <functional>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <math.h>
#include "Vec2.h"
#ifndef PI
#define PI M_PI
#endif
t... |
NullSeile/UITools | src/Rectangle.h | <filename>src/Rectangle.h<gh_stars>1-10
#pragma once
#include "Global.h"
#include "UIObject.h"
namespace ui {
class Rectangle : public sf::RectangleShape, public ui::UIObject
{
public:
Rectangle(const std::string& id);
void Draw(sf::RenderWindow& window) override;
};
} |
NullSeile/UITools | src/Line.h | <gh_stars>1-10
#pragma once
#include "Global.h"
#include "UIObject.h"
namespace ui {
class Line : public ui::UIObject
{
private:
float m_width;
ui::Vec2f m_iPos;
ui::Vec2f m_fPos;
sf::RectangleShape shape;
void Reset();
public:
Line(const std::string& id, const ui::Vec2f& iPos, const ui::Vec2f& fP... |
NullSeile/UITools | src/Sprite.h | #pragma once
#include "Global.h"
#include "UIObject.h"
namespace ui
{
class Sprite : public sf::Sprite, public ui::UIObject
{
public:
Sprite(const std::string& id);
void Draw(sf::RenderWindow& window) override;
};
} |
NullSeile/UITools | src/Button.h | #pragma once
#define m_BUTTON
#include "Global.h"
#include "UIObject.h"
#include "Interactuable.h"
namespace ui
{
class Button : public ui::UIObject, public ui::Interactuable
{
private:
std::function<void(ui::UIObject* self)> m_clickFunction;
bool m_hasClickFuncion = false;
bool m_able = true;
public:
... |
NullSeile/UITools | src/Event.h | #pragma once
#include "UIObject.h"
namespace ui {
class Event : public sf::Event
{
public:
bool handled = false;
};
}
|
NullSeile/UITools | src/Slider.h | #pragma once
#include "Global.h"
#include "UIObject.h"
#include "Interactuable.h"
namespace ui
{
class Slider : public ui::UIObject, public ui::Interactuable
{
private:
bool m_pressed = false;
float m_value = 0;
float m_offset = 0;
bool m_showValue = true;
ui::Vec2f m_range = { 0, 255 };
float m_step =... |
NullSeile/UITools | src/UIObject.h | #pragma once
#include "Global.h"
namespace ui
{
class UIObject
{
protected:
std::function<void(UIObject* self)> m_updateFunction;
std::function<void(UIObject* self)> m_beginPlayFunction;
bool m_hasCustomUpdateFunction = false;
bool m_hasCustomBeginPlayFunction = false;
public:
UIObject(const std::stri... |
NullSeile/UITools | src/Interactuable.h | <filename>src/Interactuable.h
#pragma once
#include "Global.h"
#include "Event.h"
namespace ui {
class Interactuable
{
protected:
bool m_blockEvent = true;
public:
Interactuable();
virtual void CheckInput(const sf::RenderWindow& window, ui::Event& e) = 0;
void BlockEvent(bool block);
~Interactuable(... |
NullSeile/UITools | src/Vec2.h | #pragma once
#include <SFML/System/Vector2.hpp>
#include <iostream>
namespace ui {
template<typename T>
class Vec2 : public sf::Vector2<T>
{
public:
T& min;
T& max;
Vec2()
: sf::Vector2<T>()
, min(this->x)
, max(this->y)
{
}
Vec2(T X, T Y)
: sf::Vector2<T>(X, Y)
, min(this->x)
, m... |
NullSeile/UITools | UITools.h | <gh_stars>1-10
#pragma once
#include "src/Widget.h" |
NullSeile/UITools | src/Circle.h | #pragma once
#include "Global.h"
#include "UIObject.h"
namespace ui {
class Circle : public sf::CircleShape, public UIObject
{
public:
Circle(const std::string& id);
void Draw(sf::RenderWindow& window) override;
};
} |
NullSeile/UITools | src/InteractiveGraph.h | #pragma once
#include "Graph.h"
namespace ui {
class InteractiveGraph : public Graph, public Interactuable
{
private:
ui::Vec2f m_startPos;
float m_zoom;
ui::Vec2f m_center;
ui::Vec2f m_view;
bool m_mousePressed;
float m_aspect;
void UpdateView();
public:
InteractiveGraph(const std::string& id)... |
NullSeile/UITools | src/Text.h | <filename>src/Text.h
#pragma once
#include "Global.h"
#include "UIObject.h"
namespace ui
{
class Text : public sf::Text, public ui::UIObject
{
public:
// Constructor
Text(const std::string& id);
// Generals
void Draw(sf::RenderWindow& window) override;
};
} |
pilihp64/Crackbot | plugins/sandbox/code.c | #include <lua5.1/lua.h>
#include <lua5.1/lualib.h>
#include <lua5.1/lauxlib.h>
#ifdef WIN32
#include <windows.h>
#endif
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define MEMLIMIT 5000000 //20MB
static int memused = 0;
void *alloc(void *ud, void *ptr, size_t osize, size_t nsize)
{... |
7PintsOfCherryGarcia/sqzlib | src/sqzlib/sqz_data.h | #include <zlib.h>
#define LOAD_SIZE 4L*1024L*1024L
#define NAME_SIZE 1L*1024L*1024L
#define B64 sizeof(uint64_t)
#define HEADLEN 8
#define NEND 128
#define MAGIC 151324677
#define NBLK 255U
#define QBLK 63U
#define EBLK 0U
#define FQH '@'
#define FAH '>'
#define FQS ... |
7PintsOfCherryGarcia/sqzlib | src/sqzlib/sqz_init.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "sqz_data.h"
sqzfastx_t *sqz_fastxinit(uint8_t fmt, uint64_t size)
{
uint8_t ret = 1;
sqzfastx_t *sqz = calloc(1, sizeof(sqzfastx_t));
if (!sqz) return NULL;
sqz->namesize = NAME_SIZE;
sqz->endthread = 128U... |
7PintsOfCherryGarcia/sqzlib | src/sqzlib/sqz_zlib.c | <filename>src/sqzlib/sqz_zlib.c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <zlib.h>
#include "sqz_data.h"
int64_t sqz_gzread(sqzFile sqzfp, void *buff, uint32_t len)
{
return (int64_t)gzread(sqzfp->gzfp, buff, len);
}
void sqz_gzdump(sqzFile sqzfp, const char *ofile)
{
uint8_t *buf... |
7PintsOfCherryGarcia/sqzlib | src/sqzlib/sqz_filefun.c | <reponame>7PintsOfCherryGarcia/sqzlib
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "sqz_data.h"
char zbytes[4] = {0, 0, 0, 0};
uint8_t magic1[4] = {5, 8, 5, 9};
uint8_t magic2[4] = {9, 5, 8, 5};
unsigned char cmpflag = 1;
uint8_t sqz_getformat(sqzFile sqzfp);
sqzfastx_t *s... |
7PintsOfCherryGarcia/sqzlib | examples/countseqs.c | <gh_stars>1-10
#include "sqzlib.h"
#include "klib/kseq.h"
KSEQ_INIT(sqzFile, sqzread)
int main(int argc, char *argv[])
{
int ret = 1;
if (argc == 1) {
printf("Usage: countseqs <file>\n");
return 0;
}
sqzFile sqzfp;
kseq_t *seq;
int l;
size_t n = 0;
sqzfp = sqzopen(argv... |
7PintsOfCherryGarcia/sqzlib | src/pthread/sqz_pthread.c | <filename>src/pthread/sqz_pthread.c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <zlib.h>
#include <pthread.h>
#include "../sqzlib/sqzlib.h"
#include "klib/kseq.h"
//int64_t sqzread(sqzFile file, void *buff, uint64_t len);
KSEQ_INIT(sqzFile, sqzread)
typedef struct {
pthread_mutex_t mtx;
... |
7PintsOfCherryGarcia/sqzlib | src/sqzlib/sqzlib.h | <gh_stars>1-10
/** \file sqzlib.h
<NAME> - <EMAIL>
MIT License
Copyright (c) 2021 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the righ... |
7PintsOfCherryGarcia/sqzlib | src/sqzlib/sqz_kseq.c | <gh_stars>1-10
#include <stdio.h>
#include <stdint.h>
#include "sqz_data.h"
int64_t sqzread(sqzFile file, void *buff, uint64_t len);
#include "klib/kseq.h"
KSEQ_INIT(sqzFile, sqzread)
static uint8_t sqz_checksqz(sqzFile sqzfp)
{
uint64_t tmp = 0;
uint32_t magic = 0;
uint8_t fmt = 0;
uint8_t sq... |
7PintsOfCherryGarcia/sqzlib | src/sqzlib/sqz_coding.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <zlib.h>
#include <stdint.h>
#include "sqz_data.h"
#define TWO_BIT_MASK 3
const uint8_t nblk = 255U;
const uint8_t qblk = 63U;
const uint8_t eblk = 0U;
//Table to change "ACGT" to 0123 else to 4
const unsigned char seq_nt4_tableSQZ[128] = {
... |
7PintsOfCherryGarcia/sqzlib | src/sqz.c | <filename>src/sqz.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <getopt.h>
#include <unistd.h>
typedef struct {
char ifile[256];
char ofile[256];
int nthread;
char libfmt;
} sqzopts_t;
uint8_t sqz_threadcompress(const char *ifile,
... |
7PintsOfCherryGarcia/sqzlib | src/sqzlib/sqz_zstd.c | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <zstd.h>
#include "sqz_data.h"
int64_t sqz_zstdcompress(sqzblock_t *blk, int level)
{
int64_t ret = 0;
ret = ZSTD_compress(blk->cmpbuff, blk->cmpsize,
blk->blkbuff, blk->blkpos, level);
if (ZSTD_isError(ret)) retur... |
denizkenankilic/computerVision-basic-hough | hough.h | #ifndef HOUGH_H_
#define HOUGH_H_
#include <vector>
namespace keymolen {
class Hough {
public:
Hough();
virtual ~Hough();
public:
int Transform(unsigned char* img_data, int w, int h);
std::vector< std::pair< std::pair<int, int>, std::pair<int, int> > > GetLines(int threshold);
const unsign... |
zmichaels11/rcl | rcl/src/rcl/arguments.c | <reponame>zmichaels11/rcl
// Copyright 2018 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
/... |
zmichaels11/rcl | rcl/src/rcl/common.c | // Copyright 2015 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by appli... |
sjbarigye/CPP_Primer | chap07/Exer07_04_Person.h | <filename>chap07/Exer07_04_Person.h
// For subsequent convenience, exercise 7.4 is defined as a header.
#ifndef EXER07_04_H
#define EXER07_04_H
#include <iostream>
#include <string>
using std::string;
using std::istream;
using std::ostream;
struct Person {
// friend declaration required by exercise 7.22
friend ... |
sjbarigye/CPP_Primer | chap15/Exer15_39/Exer15_39_AndQuery.h | #ifndef AND_QUERY_H
#define AND_QUERY_H
#include <memory>
#include "Exer15_39_TextQuery.h"
#include "Exer15_39_BinaryQuery.h"
#include "Exer15_39_Query.h"
class AndQuery : public BinaryQuery {
friend Query operator&(const Query&, const Query&);
AndQuery(const Query &left, const Query &right) :
BinaryQue... |
sjbarigye/CPP_Primer | chap13/Page519_542_Message.h | <filename>chap13/Page519_542_Message.h
#ifndef MESSAGE_FOLDER_H
#define MESSAGE_FOLDER_H
#include <iostream>
#include <string>
#include <set>
class Folder; // incomplete class declaration
class Message {
friend class Folder;
friend void swap(Message&, Message&);
public:
// folders is implicitly initialized ... |
sjbarigye/CPP_Primer | chap06/Page239_inline.h | <gh_stars>10-100
#ifndef INILINE_TEST
#define INILINE_TEST
#include <string>
using std::string;
inline const string &shorterString(const string &s1, const string &s2)
{
return s1.size() <= s2.size() ? s1 : s2;
}
constexpr int new_sz()
{
return 42;
}
#endif
|
sjbarigye/CPP_Primer | chap19/Exer19_17_Screen.h | // Screen header from exercise 7.23.
#ifndef EXER19_17_SCREEN_H
#define EXER19_17_SCREEN_H
#include <string>
class Screen{
// for test, required by exercise 19.12
friend void ptrTest();
public:
typedef std::string::size_type pos;
// type alias for every kind of member function, required by exercise 19.1... |
sjbarigye/CPP_Primer | chap06/Chapter6.h | <filename>chap06/Chapter6.h
// Exer06_08
#ifndef CHAP06_H
#define CHAP06_H
int fact(int);
void fact();
int abs(int);
#endif
|
sjbarigye/CPP_Primer | chap13/Exer13_28_BinStrTree_value.h | <filename>chap13/Exer13_28_BinStrTree_value.h
#ifndef EXER13_28_2_VALUE_H
#define EXER13_28_2_VALUE_H
#include <cstddef>
#include "Exer13_28_TreeNode_value.h"
class BinStrTree {
public:
BinStrTree() : root(new TreeNode()) {}
BinStrTree(const BinStrTree &bp);
BinStrTree& operator=(const BinStrTree &bp);
... |
sjbarigye/CPP_Primer | chap19/Exer19_02_StrVec.h | // StrVec from chapter 14.
#ifndef EXER19_02_STRVEC_H
#define EXER19_02_STRVEC_H
#include <cstddef>
#include <cstdlib>
#include <string>
#include <utility>
#include <memory>
#include <initializer_list>
#include "Exer19_01_new_delete.h"
using std::size_t;
using std::string;
using std::pair;
using std::allocator;
using s... |
sjbarigye/CPP_Primer | chap15/Exer15_19.h | #ifndef PAGE612_613_ACCESS_H
#define PAGE612_613_ACCESS_H
class Base {
public:
void pub_mem(); // public member
protected:
int prot_mem = 0; // protected member
private:
char priv_mem = 0; //private member
};
struct Pub_Derv : public Base {
// ok: derived classes can access protected members
int ... |
sjbarigye/CPP_Primer | chap15/Exer15_27_Bulk_quote.h | #ifndef BULK_QUOTE_H
#define BULK_QUOTE_H
#include <cstddef>
#include <iostream>
#include <string>
#include "Exer15_26_Disc_quote.h"
class Bulk_quote : public Disc_quote { // Bulk_quote inherits from Quote
public:
Bulk_quote() { std::cout << "Bulk_quote()" << std::endl; }
// inherited constructor
using Disc... |
sjbarigye/CPP_Primer | chap13/Exer13_28_TreeNode_point.h | <reponame>sjbarigye/CPP_Primer
#ifndef EXER13_28_1_POINT_H
#define EXER13_28_1_POINT_H
#include <iostream>
#include <string>
#include <cstddef>
class TreeNode {
public:
TreeNode() : count(0), left(nullptr), right(nullptr), use(new std::size_t(1)) {} // an empty node
TreeNode(const std::string &s) : value(s), co... |
sjbarigye/CPP_Primer | chap19/Exer19_26.c | <gh_stars>10-100
#include "Exer19_26.h"
int compute(int *p, int i)
{
p = &i;
return *p;
}
|
sjbarigye/CPP_Primer | chap09/Exer09_51.h | #ifndef EXER09_51_H
#define EXER09_51_H
#include <iostream>
#include <string>
#include <vector>
#include <stdexcept>
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::invalid_argument;
static const vector<string> MONALL{ "JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE",
... |
sjbarigye/CPP_Primer | chap16/Exer16_19_print_container.h | <filename>chap16/Exer16_19_print_container.h<gh_stars>10-100
#ifndef EXER16_19_PRINT_CONTAINER_H
#define EXER16_19_PRINT_CONTAINER_H
#include <iostream>
template <typename C>
void print(const C &c)
{
for(typename C::size_type i = 0; i != c.size(); ++i)
std::cout << c[i] << " ";
}
#endif
|
sjbarigye/CPP_Primer | chap16/Exer16_62_Sales_data.h | #ifndef EXER16_61_SALES_DATA_H
#define EXER16_61_SALES_DATA_H
#include <cstddef>
#include <iostream>
#include <string>
#include <functional>
using std::cout;
using std::cin;
using std::cerr;
using std::endl;
using std::string;
using std::istream;
using std::ostream;
class Sales_data {
// friend
// overloaded ou... |
sjbarigye/CPP_Primer | chap15/Exer15_11_Limit_quote.h | <gh_stars>10-100
#ifndef LIMIT_QUOTE_H
#define LIMIT_QUOTE_H
#include <cstddef>
#include "Exer15_11_Quote.h"
class Limit_quote : public Quote {
public:
Limit_quote() = default;
Limit_quote(const std::string&, double, std::size_t, double);
// overrides the base version in order to implement the bulk purchase... |
sjbarigye/CPP_Primer | chap16/Exer16_12_Blob.h | // Note: this header uses contents beyond the section, see section 16.1.3, page 669
// using class members that are types
#ifndef EXER16_12_BLOB_H
#define EXER16_12_BLOB_H
#include <string>
#include <vector>
#include <initializer_list>
#include <memory>
#include <utility>
#include <stdexcept>
template <typename T> clas... |
sjbarigye/CPP_Primer | chap07/Exer07_32_Screen.h | <reponame>sjbarigye/CPP_Primer
#ifndef EXER07_32_H
#define EXER07_32_H
#include <iostream>
#include <string>
#include <vector>
class Screen; // forward declaration here, or the program won't compile.
class Window_mgr {
public:
using ScreenIndex = std::vector<Screen>::size_type;
void clear(ScreenIndex);
Wind... |
sjbarigye/CPP_Primer | chap15/Exer15_39/Exer15_39_Query_base.h | // abstract class acts as a base for concrete query types; all members are private
#ifndef QUERY_BASE_H
#define QUERY_BASE_H
#include <string>
#include "Exer15_39_TextQuery.h"
class Query_base {
friend class Query;
protected:
using line_no = TextQuery::line_no; // used in eval functions
virtual ~Query_base(... |
sjbarigye/CPP_Primer | chap19/Exer19_20_TextQuery.h | // TextQuery class from exercise 12.30.
#ifndef EXER19_20_TEXT_QUERY_H
#define EXER19_20_TEXT_QUERY_H
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <memory>
std::string make_plural(size_t, const std::string&, const std::string&);
cla... |
sjbarigye/CPP_Primer | chap15/Exer15_15_Disc_quote.h | <reponame>sjbarigye/CPP_Primer<filename>chap15/Exer15_15_Disc_quote.h
#ifndef DISC_QUOTE_H
#define DISC_QUOTE_H
#include <cstddef>
#include <string>
#include "Exer15_15_Quote.h"
class Disc_quote : public Quote {
public:
Disc_quote() = default;
Disc_quote(const std::string &book, double price, std::size_t qty, d... |
sjbarigye/CPP_Primer | chap14/Exer14_35_ReadString.h | <reponame>sjbarigye/CPP_Primer
#ifndef READ_STRING_H
#define READ_STRING_H
#include <iostream>
#include <string>
using std::cin;
using std::istream;
using std::string;
class ReadString {
public:
ReadString(istream &i = cin) : is(i) {}
string operator()() const;
private:
istream &is;
};
string ReadString::op... |
sjbarigye/CPP_Primer | chap12/Exer12_32_TextQuery_StrBlob.h | #ifndef TEXT_QUERY_H
#define TEXT_QUERY_H
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <memory>
#include "StrBlob.h"
std::string make_plural(size_t, const std::string&, const std::string&);
class QueryResult;
class TextQuery{
public... |
sjbarigye/CPP_Primer | chap15/Exer15_39/Exer15_39_BinaryQuery.h | <filename>chap15/Exer15_39/Exer15_39_BinaryQuery.h
#ifndef BINARY_QUERY_H
#define BINARY_QUERY_H
#include <string>
#include "Exer15_39_Query_base.h"
#include "Exer15_39_Query.h"
class BinaryQuery : public Query_base {
protected:
BinaryQuery(const Query &l, const Query &r, std::string s) :
lhs(l), rhs(r), op... |
sjbarigye/CPP_Primer | chap07/Exer07_58_example.h | // Exercise 7.58
#include <vector>
using std::vector;
class Example {
public:
static double rate;
static const int vecSize = 20;
static vector<double> vec;
};
|
sjbarigye/CPP_Primer | chap16/Exer16_58_StrVec.h | <reponame>sjbarigye/CPP_Primer
#ifndef EXER16_58_STRVEC_H
#define EXER16_58_STRVEC_H
#include <cstddef>
#include <iostream>
#include <string>
#include <utility>
#include <memory>
#include <initializer_list>
class StrVec {
// equality operator required by exercise 14.16
friend bool operator==(const StrVec&, cons... |
sjbarigye/CPP_Primer | chap13/Exer13_55_String.h | // Inheritance: exercise 13.49.
// Note: see Exer19_18.cpp for the explanation of the problem issued in note.
#ifndef STRING_SIMPLE_H
#define STRING_SIMPLE_H
#include <iostream>
#include <cstddef>
#include <cstring>
#include <utility>
#include <memory>
#include <algorithm>
class String {
public:
String();
Strin... |
sjbarigye/CPP_Primer | chap15/Exer15_39/Exer15_39_TextQuery.h | <reponame>sjbarigye/CPP_Primer
#ifndef TEXT_QUERY_H
#define TEXT_QUERY_H
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <memory>
std::string make_plural(size_t, const std::string&, const std::string&);
class QueryResult;
class TextQue... |
sjbarigye/CPP_Primer | chap18/Exer18_07_Blob.h | <reponame>sjbarigye/CPP_Primer
// Blob class template from exercise 16.29
#ifndef EXER18_07_BLOB_H
#define EXER18_07_BLOB_H
#include <iostream>
#include <string>
#include <vector>
#include <initializer_list>
#include <memory>
#include <utility>
#include <stdexcept>
template <typename T> class BlobPtr;
template <typenam... |
sjbarigye/CPP_Primer | chap14/Exer14_34.h | <reponame>sjbarigye/CPP_Primer
#ifndef FINAL_GRADE_H
#define FINAL_GRADE_H
#include <string>
using std::string;
class FinalGrade {
public:
const string& operator()(bool grade, const string &s1, const string &s2) const {
return grade ? s1 : s2;
}
};
#endif
|
sjbarigye/CPP_Primer | chap14/Exer14_21_Sales_data.h | <gh_stars>10-100
#ifndef SALES_DATA_H
#define SALES_DATA_H
#include <iostream>
#include <string>
class Sales_data {
// friend
// overloaded output operator required by exercise 14.6
friend std::ostream &operator<<(std::ostream&, const Sales_data&);
// overloaded input operator required by exercise 14.9
... |
sjbarigye/CPP_Primer | chap16/Exer16_21_DebugDelete.h | #ifndef EXER16_21_DEBUG_DELETE_H
#define EXER16_21_DEBUG_DELETE_H
#include <iostream>
// function-object class that calls delete on a given pointer
class DebugDelete {
public:
DebugDelete(std::ostream &s = std::cerr) : os(s) {}
// as with any function template, the type of T is deduced by the compiler
templ... |
sjbarigye/CPP_Primer | chap07/Exer07_40_Book.h | <reponame>sjbarigye/CPP_Primer
// Note: this is a redefinition from chapter 14. It covers contents beyond chapter 7.
#ifndef EXER07_40_BOOK_H
#define EXER07_40_BOOK_H
#include <string>
#include <utility>
using std::string;
class Book {
public:
Book() = default;
Book(string na, string au = "", string no = "") :
... |
sjbarigye/CPP_Primer | chap13/Exer13_27_HasPtr.h | #ifndef EXER13_27_H
#define EXER13_27_H
#include <cstddef>
#include <string>
class HasPtr {
public:
// constructor allocates a new std::string and a new counter, which it sets to 1
HasPtr(const std::string&s = std::string()) : ps(new std::string(s)), i(0), use(new std::size_t(1)) {}
// copy constructor copi... |
sjbarigye/CPP_Primer | chap15/Exer15_01_Quote.h | <reponame>sjbarigye/CPP_Primer
#ifndef QUOTE_H
#define QUOTE_H
#include <cstddef>
#include <iostream>
#include <string>
class Quote {
public:
Quote() = default;
Quote(const std::string &book, double sales_price) : bookNo(book), price(sales_price) {}
std::string isbn() const { return bookNo; }
// return ... |
sjbarigye/CPP_Primer | chap19/Sales_data.h | // Warning: this header is used by multiple source files and has special friends for them. Take care if
// you want to change the name of this file.
#ifndef SALES_DATA_H
#define SALES_DATA_H
#include <iostream>
#include <string>
#include <cstddef> // required by exercise 19.19
#include <vector> // required by exercise... |
sjbarigye/CPP_Primer | chap15/Exer15_15_Bulk_quote.h | #ifndef BULK_QUOTE_H
#define BULK_QUOTE_H
#include <cstddef>
#include <string>
#include "Exer15_15_Disc_quote.h"
class Bulk_quote : public Disc_quote { // Bulk_quote inherits from Quote
public:
Bulk_quote() = default;
Bulk_quote(const std::string &book, double price, std::size_t qty, double disc) :
Disc... |
sjbarigye/CPP_Primer | chap15/Exer15_30_Basket.h | #ifndef BASKET_H
#define BASKET_H
#include <iostream>
#include <set>
#include <memory>
#include <utility>
#include "Exer15_30_Quote.h"
#include "Exer15_30_Bulk_quote.h"
class Basket {
public:
// basket uses synthesized default constructor and copy-control members
void add_item(const Quote &sale)
{ items... |
sjbarigye/CPP_Primer | chap16/Exer16_58_Vec.h | #ifndef EXER16_58_VEC_H
#define EXER16_58_VEC_H
#include <cstddef>
#include <utility>
#include <memory>
#include <initializer_list>
template <typename T> class Vec;
// equality operator required by exercise 14.16
template <typename T> bool operator==(const Vec<T>&, const Vec<T>&);
template <typename T> bool operator!=(... |
sjbarigye/CPP_Primer | chap13/Page524_536_StrVec.h | #ifndef STRVEC_H
#define STRVEC_H
#include <cstddef>
#include <string>
#include <utility>
#include <memory>
#include <initializer_list>
class StrVec {
public:
StrVec(): elements(nullptr), first_free(nullptr), cap(nullptr) {}
StrVec(const StrVec&);
// move constructor from page 536
StrVec(StrVec&&) noexc... |
sjbarigye/CPP_Primer | chap16/Exer16_65_debug_rep.h | #ifndef EXER16_65_DEBUG_RET_H
#define EXER16_65_DEBUG_RET_H
#include <iostream>
#include <sstream>
#include <string>
// declare all of the overloaded functions first to avoid silently instantiated template version
// print any type we don't otherwise handle
template <typename T> std::string debug_rep(const T&);
templat... |
sjbarigye/CPP_Primer | chap15/Exer15_35_Query.h | <reponame>sjbarigye/CPP_Primer
// abstract class acts as a base for concrete query types; all members are private
#ifndef QUERY_BASE_H
#define QUERY_BASE_H
#include <iostream>
#include <string>
#include <memory>
#include "Exer15_35_TextQuery.h"
class Query_base {
friend class Query;
protected:
Query_base() {
... |
sjbarigye/CPP_Primer | chap16/Exer16_14_15_Screen.h | #ifndef EXER16_14_15_SCREEN_H
#define EXER16_14_15_SCREEN_H
#include <iostream>
#include <string>
#include <vector>
template <unsigned H, unsigned W> class Screen;
template <unsigned H, unsigned W> std::ostream& operator<<(std::ostream&, const Screen<H, W>&);
template <unsigned H, unsigned W> std::istream& operator>>(s... |
sjbarigye/CPP_Primer | chap06/Page224_makeplural.h | <filename>chap06/Page224_makeplural.h
// This function will be used frequently by subsequent chapters.
#include <string>
using std::string;
string make_plural(size_t ctr, const string &word, const string &ending)
{
return (ctr > 1) ? word + ending : word;
}
|
sjbarigye/CPP_Primer | chap15/Page612_613_access.h | #ifndef PAGE612_613_ACCESS_H
#define PAGE612_613_ACCESS_H
class Base {
public:
void pub_mem(); // public member
protected:
int prot_mem = 0; // protected member
private:
char priv_mem = 0; //private member
};
struct Pub_Derv : public Base {
// ok: derived classes can access protected members
int ... |
sjbarigye/CPP_Primer | chap15/Exer15_39/Exer15_39_WordQuery.h | <gh_stars>10-100
#ifndef WORD_QUERY_H
#define WORD_QUERY_H
#include <string>
#include "Exer15_39_TextQuery.h"
#include "Exer15_39_Query_base.h"
class WordQuery : public Query_base {
friend class Query; // Query uses the WordQuery constructors
WordQuery(const std::string &s) : query_word(s) {}
// concrete cl... |
sjbarigye/CPP_Primer | chap15/Exer15_39/Exer15_39_Query.h | // interface class to manage the Query_base inheritance hierarchy
#ifndef QUERY_H
#define QUERY_H
#include <iostream>
#include <memory>
#include <string>
#include "Exer15_39_TextQuery.h"
#include "Exer15_39_WordQuery.h"
class Query {
// these operators access to the shared_ptr constructor
friend Query operator~(const... |
sjbarigye/CPP_Primer | chap16/Exer16_04_find.h | <gh_stars>10-100
#ifndef EXER16_04_FIND_H
#define EXER16_04_FIND_H
template <typename TI, typename TV>
TI find(TI begin, TI end, const TV &val)
{
while(begin != end)
{
if(*begin == val)
return begin;
++begin;
}
return end;
}
#endif
|
sjbarigye/CPP_Primer | chap15/Exer15_30_Quote.h | #ifndef QUOTE_H
#define QUOTE_H
#include <cstddef>
#include <iostream>
#include <string>
#include <utility>
class Quote {
public:
Quote()=default;
Quote(const std::string &book, double sales_price) : bookNo(book), price(sales_price) {}
std::string isbn() const { return bookNo; }
// return the total sale... |
sjbarigye/CPP_Primer | chap15/Exer15_16_Limit_quote.h | <gh_stars>10-100
#ifndef LIMIT_QUOTE_H
#define LIMIT_QUOTE_H
#include <cstddef>
#include "Exer15_15_Disc_quote.h"
class Limit_quote : public Disc_quote {
public:
Limit_quote() = default;
Limit_quote(const std::string &book, double price, std::size_t qty, double disc) :
Disc_quote(book, price, qty, disc)... |
sjbarigye/CPP_Primer | chap18/Exer18_09_Sales_data.h | <filename>chap18/Exer18_09_Sales_data.h
#ifndef EXER18_09_SALES_DATA_H
#define EXER18_09_SALES_DATA_H
#include <iostream>
#include <string>
#include <stdexcept>
// exception classes
class out_of_stock: public std::runtime_error {
public:
explicit out_of_stock(const std::string &s): runtime_error(s) {}
};
class isbn... |
sjbarigye/CPP_Primer | chap13/Exer13_28_TreeNode_value.h | #ifndef EXER13_28_1_VALUE_H
#define EXER13_28_1_VALUE_H
#include <iostream>
#include <string>
#include <cstddef>
class TreeNode {
public:
TreeNode() : count(1), left(nullptr), right(nullptr) {} // an empty node
TreeNode(const std::string &s) : value(s), count(1), left(nullptr), right(nullptr) {}
TreeNode(co... |
sjbarigye/CPP_Primer | chap15/Exer15_30_Disc_quote.h | #ifndef DISC_QUOTE_H
#define DISC_QUOTE_H
#include <cstddef>
#include <iostream>
#include <string>
#include <utility>
#include "Exer15_30_Quote.h"
class Disc_quote : public Quote {
public:
Disc_quote()=default;
Disc_quote(const std::string &book, double price, std::size_t qty, double disc):
Quote(book, ... |
sjbarigye/CPP_Primer | chap15/Exer15_39/Exer15_39_NotQuery.h | <gh_stars>10-100
#ifndef NOT_QUERY_H
#define NOT_QUERY_H
#include <string>
#include <memory>
#include "Exer15_39_TextQuery.h"
#include "Exer15_39_Query_base.h"
#include "Exer15_39_Query.h"
class NotQuery : public Query_base {
friend Query operator~(const Query&);
NotQuery(const Query &q) : query(q) {}
// co... |
sjbarigye/CPP_Primer | chap14/Book.h | <reponame>sjbarigye/CPP_Primer<gh_stars>10-100
#ifndef BOOK_H
#define BOOK_H
#include <iostream>
#include <string>
#include <utility>
using std::ostream;
using std::istream;
using std::string;
class Book {
// overloaded output operator required by exercise 14.8
friend ostream &operator<<(ostream&, const Book&);... |
sjbarigye/CPP_Primer | chap15/Exer15_39/Exer15_39_OrQuery.h | <reponame>sjbarigye/CPP_Primer<filename>chap15/Exer15_39/Exer15_39_OrQuery.h
#ifndef OR_QUERY_H
#define OR_QUERY_H
#include <memory>
#include "Exer15_39_TextQuery.h"
#include "Exer15_39_BinaryQuery.h"
#include "Exer15_39_Query.h"
class OrQuery : public BinaryQuery {
friend Query operator|(const Query&, const Query&... |
sjbarigye/CPP_Primer | chap07/Exer07_49_Sales_data.h | #ifndef SALES_DATA_H
#define SALES_DATA_H
#include <iostream>
#include <string>
// substitute class for struct
class Sales_data {
// friend
friend std::istream& read(std::istream&, Sales_data&);
friend std::ostream& print(std::ostream& os, const Sales_data& item);
friend Sales_data add(const Sales_data&... |
sjbarigye/CPP_Primer | chap13/Exer13_15.h | <gh_stars>10-100
#ifndef EXER13_14_H
#define EXER13_14_H
#include <iostream>
#include <cstdlib>
struct numbered {
numbered() : mysn(rand()) {}
numbered(const numbered&) : mysn(rand()) {}
int mysn = 0;
};
void f(numbered s) { std::cout << s.mysn << std::endl; } // copy constructor always generates a new valu... |
sjbarigye/CPP_Primer | chap16/Exer16_29_Blob.h | // Note: this header has an unsolved problem. See notes below.
#ifndef EXER16_29_BLOB_H
#define EXER16_29_BLOB_H
#include <string>
#include <vector>
#include <initializer_list>
#include <utility>
#include <stdexcept>
#include "Exer16_28_shared_ptr.h"
// #include <memory> // must be excluded, see notes below.
template <... |
sjbarigye/CPP_Primer | chap19/Exer19_01_new_delete.h | #ifndef EXER19_01_MEMORY_H
#define EXER19_01_MEMORY_H
#include <iostream>
#include <cstddef>
#include <cstdlib>
#include <new>
inline void *operator new(std::size_t size)
{
std::cout << "You are using self-defined version of new!" << std::endl;
if(void* mem = std::malloc(size))
return mem;
else
... |
sjbarigye/CPP_Primer | chap16/Exer16_05_print.h | #ifndef EXER16_05_PRINT_H
#define EXER16_05_PRINT_H
#include <iostream>
template <typename V, unsigned N>
void print(const V (&arr)[N])
{
for(auto elem : arr) {
std::cout << elem << " ";
}
std::cout << std::endl;
}
#endif
|
sjbarigye/CPP_Primer | chap13/Exer13_28_BinStrTree_point.h | <reponame>sjbarigye/CPP_Primer<gh_stars>10-100
#ifndef EXER13_28_2_POINT_H
#define EXER13_28_2_POINT_H
#include <cstddef>
#include "Exer13_28_TreeNode_point.h"
class BinStrTree {
public:
BinStrTree() : root(new TreeNode()), use(new std::size_t(1)) {}
BinStrTree(const BinStrTree &bp) : root(bp.root), use(bp.use)... |
sjbarigye/CPP_Primer | chap19/Exer19_21_25_Token.h | <filename>chap19/Exer19_21_25_Token.h
// Warning: Visual Studio 2013 doesn't support union with class type member that has copy-control
// operations. Use higher version or other compilers.
#ifndef EXER19_21_TOKEN_H
#define EXER19_21_TOKEN_H
#include <iostream>
#include <string>
#include <utility>
#include "Sales_data.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.