You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-07 03:22:57 +03:00
Deep build refactoring phase 2 (#3564)
* configcpp refactored * chore(build): massive removals, auto add files to debian install file * chore(build): configure before autobake * chore(build): use custom cmake commands for components, mariadb-plugin-columnstore.install generated * chore(build): install deps as separate step for build-packages * more deps * chore(codemanagement, build): build refactoring stage2 * chore(safety): Locked Map for MessageqCpp with a simpler way Please enter the commit message for your changes. Lines starting * chore(codemanagement, ci): better coredumps handling, deps fixed * Delete build/bootstrap_mcs.py * Update charset.cpp (add license)
This commit is contained in:
@@ -1,157 +0,0 @@
|
||||
/* Copyright (C) 2014 InfiniDB, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; version 2 of
|
||||
the License.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/** @file */
|
||||
|
||||
/*
|
||||
* classes isyncstream and osyncstream provide a C++ iostream interface
|
||||
* for C stdio FILE* streams. The current implementation does not provide
|
||||
* the necessary methods to support seeking. The I/O buffering of the
|
||||
* input FILE* is used. The C++ iostream library calls syncbuf::sync()
|
||||
* for every line, so output buffering is line-by-line.
|
||||
* */
|
||||
|
||||
/*
|
||||
#include "syncstream.h"
|
||||
|
||||
void copyStream(istream& iss, ostream& oss)
|
||||
{
|
||||
string line;
|
||||
getline(iss, line);
|
||||
while (iss.good())
|
||||
{
|
||||
oss << line << endl;
|
||||
getline(iss, line);
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
FILE* ifp;
|
||||
FILE* ofp;
|
||||
|
||||
...
|
||||
|
||||
isyncstream iss(ifp);
|
||||
osyncstream oss(ofp);
|
||||
|
||||
copyStream(iss, oss);
|
||||
|
||||
...
|
||||
}
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
namespace syncstream
|
||||
{
|
||||
/** A streambuf implementation for C stdio FILE* streams.
|
||||
*
|
||||
* Adapted from http://www.drdobbs.com/184401305
|
||||
*/
|
||||
class syncbuf : public std::streambuf
|
||||
{
|
||||
public:
|
||||
/** ctor */
|
||||
syncbuf(FILE* f) : std::streambuf(), fptr(f)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
/** Write character in the case of overflow */
|
||||
virtual int overflow(int c = EOF)
|
||||
{
|
||||
return (c != EOF ? fputc(c, fptr) : EOF);
|
||||
}
|
||||
/** Get character in the case of overflow */
|
||||
virtual int underflow()
|
||||
{
|
||||
int c = getc(fptr);
|
||||
|
||||
if (c != EOF)
|
||||
ungetc(c, fptr);
|
||||
|
||||
return c;
|
||||
}
|
||||
/** Get character in the case of overflow and advance get pointer */
|
||||
virtual int uflow()
|
||||
{
|
||||
return getc(fptr);
|
||||
}
|
||||
/** put character back in the case of backup underflow */
|
||||
virtual int pbackfail(int c = EOF)
|
||||
{
|
||||
return (c != EOF ? ungetc(c, fptr) : EOF);
|
||||
}
|
||||
/** Synchronize stream buffer */
|
||||
virtual int sync()
|
||||
{
|
||||
return fflush(fptr);
|
||||
}
|
||||
|
||||
private:
|
||||
FILE* fptr;
|
||||
};
|
||||
|
||||
/** An istream adaptor for input FILE* streams */
|
||||
class isyncstream : public std::istream
|
||||
{
|
||||
public:
|
||||
/** ctor */
|
||||
isyncstream() : istream(&buf), buf(0)
|
||||
{
|
||||
}
|
||||
/** ctor */
|
||||
isyncstream(FILE* fptr) : istream(&buf), buf(fptr)
|
||||
{
|
||||
}
|
||||
/** const streambuf accessor */
|
||||
const syncbuf* rdbuf() const
|
||||
{
|
||||
return &buf;
|
||||
}
|
||||
|
||||
private:
|
||||
syncbuf buf;
|
||||
};
|
||||
|
||||
/** An ostream adaptor for output FILE* streams */
|
||||
class osyncstream : public std::ostream
|
||||
{
|
||||
public:
|
||||
/** ctor */
|
||||
osyncstream() : ostream(&buf), buf(0)
|
||||
{
|
||||
}
|
||||
/** ctor */
|
||||
osyncstream(FILE* fptr) : ostream(&buf), buf(fptr)
|
||||
{
|
||||
}
|
||||
/** const streambuf accessor */
|
||||
const syncbuf* rdbuf() const
|
||||
{
|
||||
return &buf;
|
||||
}
|
||||
|
||||
private:
|
||||
syncbuf buf;
|
||||
};
|
||||
|
||||
} // namespace syncstream
|
Reference in New Issue
Block a user