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
0
votes
2answers
126 views

Fetch an array result set using a mysqli wrapper class

I have a PHP class: ...
4
votes
0answers
262 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
59 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
31 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
202 views

Wrapper Connection PDO PHP [closed]

This is my wrapper, how can i improve this? (With a Singleton too) ...
3
votes
2answers
93 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. ...
8
votes
3answers
814 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 ...
7
votes
1answer
2k 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
654 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
3k 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
677 views

Proper use of a generic value type wrapper class

I have a wrapper class: ...
2
votes
2answers
366 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
6k 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
203 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
69 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
6k 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
269 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
2k 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
76 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
70 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
376 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
114 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
367 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
119 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
196 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
66 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
631 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
12k 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
841 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
141 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 ...
2
votes
1answer
195 views

Wrapper class for adding elements to HashSet

I have many object of class Test. I want to be sure that among them, there are no two objects o1 and ...
4
votes
1answer
900 views

Window Creation Wrapper Class

This Question now has a follow-up here I don't think that there is any new technique in my code but in my opinion it's ok all in all (with a bit of magic). Maybe you can find something to improve or ...
4
votes
1answer
290 views

Angular wrapper for SignalR event aggregator

I created a little wrapper for one of my JavaScript libraries to enable Angular functionality. Are there any pitfalls I should be wary of with my code? ...
15
votes
1answer
478 views

Event-based Xbox Controller polling

The goal of the following code is to be able to use an Xbox Controller in a Java program, it works with the jinput library. Unfortunately this library is rather old, has little to no documentation ...
3
votes
1answer
112 views

RAII style API wrapper for PyMongo

I just watched Raymond Hettinger's talk on making Python more Pythonic and realized I should be putting a lot of his ideas into practice, particularly wrapping API's in a class that makes everything ...
4
votes
2answers
490 views

Encryption wrapper

I am writing an encryption class using Crypto++. The idea is that the client connects using RSA (encrypt, decrypt) with username, password, 32 byte key. The server will then return using the stream ...
3
votes
2answers
529 views

BigDecimal wrapper that ignores zero operands

I want to perform mathematical operations on a range of values, where zeros should be ignored. This means that multiplication by zero does not result in zero but returns the first operand and likewise ...
2
votes
1answer
62 views

Simple DB API for inserting a record

I'm looking to make some improvements to a deliberately crude API written in PHP, it's designed to handle simple requests and talk to the DB. I have the following DB class: ...
2
votes
2answers
341 views

PDO wrapper with validation

After moving from mysql_ to PDO I created a PDO handling function. Basically this function takes parameters, checks them and returns end result. The thing is that I created this ~1 year ago and haven'...
2
votes
1answer
208 views

Throwing exceptions in a database wrapper

I hope the extension methods ThrowArgumentNullExceptionIfNullOrEmpty and ThrowNullReferenceExceptionIfNullOrEmpty are ...
4
votes
1answer
734 views

Wrapper library for Google Static Maps API

I've recently read the books Clean Code and Effective Java. I am a huge fan of Object-Oriented Java. I am trying to write as professionally as possible. I have been an Android Developer for 20 months ...
5
votes
2answers
2k views

C++/CLI wrapper around a C library

I have a C library written by a third-party company. It calculates photo positions on a book page, position of a photo inside an area (which part of the photo to crop), it fills a book with random ...
3
votes
3answers
2k views

Simple wrapper for LocalReport

I've built a wrapper for a LocalReport and I would like to hear your suggestions about it: ...
3
votes
3answers
1k views

PDO class and security

I have started a project in PHP with PDO and I'm almost done, but I've read somewhere that PDO escape alone is not secure and we have to consider some settings of PDP. I am a little confused about my ...