Questions tagged [wrapper]

A wrapper is an OOP technique where an object encapsulates (wraps) another object, hiding/protecting the object and controlling all access to it.

Filter by
Sorted by
Tagged with
5
votes
1answer
1k views

Simple C++ wrapper over libYAML

For a personal project, I need to parse YAML file. I chose to use C-based libYAML instead of yaml-cpp, because: I try to keep my dependencies to what's commonly installed and Debian statistics show ...
2
votes
1answer
412 views

Wrapper class for executing database queries

I have a wrapper class for executing database queries from an ASP.NET application. Please provide suggestions on how I can improve this class. It is working fine. Anyone can use this class in their ...
1
vote
0answers
160 views

Wrapper for GMP in C++

I'm writing a C++ high precision library based on GMP, sample code(files which have to be added to project): ...
7
votes
1answer
199 views

Linux/Mac hashing SHA-1

To do password exchange on the SQL server I need to use SHA-1 to generate a hash (no plain password exchange). This is done differently on Linux/Mac so I abstracted it slightly. ThorCryptWrapper.h <...
8
votes
1answer
2k views

Wrapping libusb library in C++

I want to use libusb library in my C++ application. I have created classes which wraps libusb functions. You can see that libusb API is split into 8 sections: http://libusb.sourceforge.net/api-1.0/...
4
votes
3answers
4k views

Enum wrapped in a struct

I was thinking about how I was going to use some enums I made, how I was going to make sure they had valid values and how to call the class which would contain the necessary extensions methods. And ...
1
vote
1answer
484 views

Multithreaded cURL wrapper

The following is a class for curl wrapper. This class will be called like: ...
0
votes
1answer
253 views

Caching wrapper for digest computation

I need to review this code: ...
4
votes
2answers
4k views

C++ Wrapper for cURL: Multithreading and serializing asynchronous ops

I did this library to help me from one of my projects and decided to publish it on GitHub hoping people might find it useful, convenient and easy to use in their projects too. It's a header-only ...
6
votes
1answer
184 views

Random generator extension for VSCode

Background A VSCode extension that uses Chance.JS to generate random data types. Concerns My main concern is that there are 4 levels of function references that feels like a hack. From ...
1
vote
0answers
231 views

simpler pattern/extension built on top of telepot (telegram bot api wrapper)

simpler pattern/extension built on top of telepot (telegram bot api wrapper) filter usage ...
2
votes
1answer
184 views

Wrapping Checkers

The next post in my Checker series: The C# wrapper for my F# library to make it cleaner for these methods to be called from C# code. GeneralTypes.cs ...
3
votes
1answer
289 views

C++ Dirent.h “Wrapper”

I do not want to call this a wrapper, but no other name comes to mind right now, so I'll use it incorrectly for the rest of the question - It's just a class that adds C++ functions to ...
4
votes
1answer
310 views

C++ OpenGLBuffer class, wrapper around the raw OpenGL api

I am trying to code a thin wrapper around the OpenGL so I can use it more convenient. This class is not 100% done yet, but I don't want to do all typing for nothing. And I think the design is clear. I ...
0
votes
2answers
131 views

Fetch an array result set using a mysqli wrapper class

I have a PHP class: ...
4
votes
0answers
332 views

PowerShell Export-CSV with Cultural Awareness

I recently had a requirement to export data to CSV in a different culture & hit an issue (see https://stackoverflow.com/a/40871162/361842). Here's my workaround: ...
2
votes
1answer
64 views

Array whose first element is arbitralily indexed – writing a container wrapper

The problem: In C++ arrays and SequenceContainers http://en.cppreference.com/w/cpp/concept/SequenceContainer (std::array, ...
5
votes
1answer
33 views

Short header file for safe CLI input handling in C

Proper input handling is a pain in the butt in C, so as part of a project of mine, this header is used to handle reoccurring command line input tasks such as input loops, reading lines and tokenizing ...
-1
votes
2answers
217 views

Wrapper Connection PDO PHP [closed]

This is my wrapper, how can i improve this? (With a Singleton too) ...
3
votes
2answers
120 views

Python 'wrapper' around `dig` for easier TSIG signing of queries

I wrote this Python script as a utility script for me. It's something that could be achieved in a simple shell script or alias, but it wasn't 'verbose' enough for me in that format, or customizable. ...
9
votes
3answers
1k views

Wrapping COM objects with IDisposable

One of the things believed to contribute to destabilizing Rubberduck 2.x, is the fact that a lot of COM object references are stored in many places, and ...
4
votes
1answer
2k views

C++ lock wrapper class around pointer

I have created a class which wraps pointers and behaves like a pointer would behave, minus a few cases. It is a lock wrapper class which simply locks before usage of the pointer and unlocks once the ...
8
votes
1answer
4k views

Primitive Type Wrapper in C++

In C++, primitive types are treated differently than user-defined types. If you do not initialize them, their values are undefined in some cases. This is an easy mistake to make. I wanted to make a ...
3
votes
0answers
768 views

zlib wrapper class

I needed to write zlib wrapper class for my application, so I can change it with different algorithm later if I want to do so. Here is the simple version: ...
1
vote
2answers
4k views

PHP PDO Wrapper

Here's a PHP PDO wrapper class that I wrote, along with example usage. This class features 2 primary methods for interacting with a database: Query(), which returns ...
3
votes
3answers
1k views

Proper use of a generic value type wrapper class

I have a wrapper class: ...
2
votes
2answers
408 views

Basic API wrapper around a Restful service - follow-up

This is a follow up from my previous post: Basic API wrapper around a Restful service I'm writing a basic wrapper around a restful service that returns a list of Stores. Naturally, I want to make it ...
5
votes
2answers
7k views

Basic API wrapper around a Restful service

I'm writing a basic wrapper around a restful service that returns a list of Stores. I'm using RestSharp which I'm injecting into the class. Naturally, I want to make it completely testable (that's a ...
5
votes
1answer
278 views

Wrapper class for the shell “dir” utility

I was inspired to throw this class together by an SO question and thought I'd subject it to some welcome criticism here. The class is basically just a wrapper around the shell utility ...
5
votes
1answer
70 views

`ls` indicates when directory is empty/full of dotfiles

I want ls to print a message when run on an empty or full of dotfiles directory. Instead of: $ ls empty_dir/ dotfiles/ $ I ...
3
votes
1answer
7k views

Shell script wrapper for Docker build and run

I have written a simple wrapper for docker build and docker run that allows me to build and run my image without having to use ...
5
votes
1answer
297 views

Python wrapper for Instagram API

This code wraps the user endpoint and media endpoint of Instagram API. Any best practices/ styles or glaring bugs you can see? I wrote some unit tests for each class but did not include for ...
3
votes
3answers
3k views

Wrapping a CSV file for access and testing

I have a simple class that represents and accesses the data from a CSV file (using the CsvHelper library). I've tried restructuring the code to allow for better unit testing, but I'm sure the ...
1
vote
0answers
80 views

Wrapper for a vendor API that lacks common interfaces

I know basic Java, but I struggle sometimes with object orientation design. There is a vendor api I use, and I wanted to wrap it to be reusable as a lib in other projects. All the services from the ...
1
vote
0answers
82 views

Wrap glium_text so that parameters aren't passed redundantly

I was annoyed by the API of glium_text, so I decided to make a wrapper that cleans up the API instead of coding my own text rendering. (I might do that later.) The wrapping turned out to be rather ...
2
votes
0answers
76 views

Pointers for C++/CLI library header formatting, layout and design

I have designed a C++/CLI wrapper library that allows C++ applications on windows, and other platforms that can load C dlls (e.g. Java via JNA or Python) to make calls to my .Net library. I was ...
1
vote
0answers
388 views

Session wrapper for PHP that supports alternative session handlers

I'm developing a session wrapper for the next version of a framework that I've been working on for the past few years. I want to support a variety of PHP session handlers. Laravel's session package ...
4
votes
1answer
126 views

Wrapping a non-unique handle with additional information

I have a situation where I'd like to wrap up some plain C handles into a class, with a destructor and other niceties, in C++. I would like the wrapper class to have the exact same size as the handle, ...
12
votes
2answers
455 views

Data marshaling wrapper for a TCP server

After a lot of research, I created this wrapper which I think fits very well to my needs. My project is a TCP server and I will be using this wrapper every time the server receives a packet. Basically,...
0
votes
1answer
3k views

Creating a wrapper function for jQuery Ajax

I am creating a few functions that wrap around jQuery's Ajax function to make it a bit quicker and easier to perform a request. For this I have this JavaScript file: ...
3
votes
1answer
138 views

Extended PDO class for MySQL

I recently started with object oriented programming in PHP and I am wondering if my database class is on the right track. Am I doing something wrong? If so, how can I improve it? Here is the class: ...
2
votes
2answers
233 views

console.log helper function

I've seen the code for this function in John Resig's book 'Secrets of JavaScript Ninja' yesterday. I considered it useful at once because I've disliked repeatedly typing ...
2
votes
0answers
69 views

Wrapping a small animation library for Angular

I've started out working on a larger project using Angular for the first time. For visual feedback, I'm using Waves (Github) (you can see a demo page here). The standard way to use Waves is to ...
1
vote
0answers
40 views

Wrapping a function in other function to generate Json Patches

I have a view that is dynamically generated from a JSON file on Angular, and I am using JSON-Patch (RFC6902) to generate patches when the user modifies its values. I start observing the JSON since ...
5
votes
2answers
1k views

C array wrapper

As part of a larger project I wanted to write my own size once RAII C array wrapper. Now I could have just used std::vector, which I'm sure is the first thing ...
1
vote
1answer
705 views

Xbox controller wrapper

I spent far too much time trying to simply get data from an Xbox controller with Python. This is the cleaned up result, classified. This requires xinput1_3 or possibly 1_4 - I'm running Windows 7 and ...
7
votes
2answers
16k views

Wrapping tuples to be used as keys in a Dictionary

I'm currently working on a project where I have to map some objects to several properties. Basically I need a Dictionary with Tuples as keys and instances of MyClass as values. As using tuples can ...
3
votes
1answer
2k views

.NET MSSQL Wrapper

Back in late 2012, I wrote the following C# .NET MSSQL Wrapper, which offered the following operations: ExecuteScalar (for selecting single field from a row) ...
5
votes
2answers
924 views

Wrapper class for PHPMailer

Is this a right way to use/implement an external library into a project? If it's not how do you do it? ...
1
vote
0answers
155 views

Follow-up: Window Creation Wrapper Class

This is the revised version of the Window Creation Wrapper Class. I tried to improve the code due to the remarks of @user1118321 (see posted link) and I hope for further reviews. For instance, you ...